[lj@localhost test-network]$ ./network.sh up
Using docker and docker-compose
Starting nodes with CLI timeout of '5' tries and CLI delay of '3' seconds and using database 'leveldb' with crypto from 'cryptogen'
docker: Cannot connect to the Docker daemon at unix:///var/run/docker.sock. Is the docker daemon running?.
See 'docker run --help'.
LOCAL_VERSION=2.3.0
DOCKER_IMAGE_VERSION=
Local fabric binaries and docker images are out of sync. This may cause problems.
/home/lj/fabric/scripts/fabric-samples/bin/cryptogen
Generating certificates using cryptogen tool
Creating Org1 Identities
+ cryptogen generate --config=./organizations/cryptogen/crypto-config-org1.yaml --output=organizations
org1.example.com
+ res=0
Creating Org2 Identities
+ cryptogen generate --config=./organizations/cryptogen/crypto-config-org2.yaml --output=organizations
org2.example.com
+ res=0
Creating Orderer Org Identities
+ cryptogen generate --config=./organizations/cryptogen/crypto-config-orderer.yaml --output=organizations
+ res=0
Generating CCP files for Org1 and Org2
ERROR: Couldn't connect to Docker daemon at http+docker://localhost - is it running?

If it's at a non-standard location, specify the URL with the DOCKER_HOST environment variable.
Cannot connect to the Docker daemon at unix:///var/run/docker.sock. Is the docker daemon running?
Unable to start network

Couldn‘t connect to Docker daemon at http+docker://localhost - is it running?_http


解决方法:

1、启动docker服务

service docker start

2、生成自启动服务

systemctl enable docker.service

3、查看服务状态,Active状态为:active(running)

systemctl status docker.service

运行结果

[lj@localhost test-network]$ service docker start
Redirecting to /bin/systemctl start docker.service

[lj@localhost test-network]$ systemctl enable docker.service
Created symlink from /etc/systemd/system/multi-user.target.wants/docker.service to /usr/lib/systemd/system/docker.service.

[lj@localhost test-network]$ systemctl status docker.service
● docker.service - Docker Application Container Engine
Loaded: loaded (/usr/lib/systemd/system/docker.service; enabled; vendor preset: disabled)
Active: active (running) since 五 2022-06-03 02:07:47 CST; 35s ago
Docs: https://docs.docker.com
Main PID: 3811 (dockerd)
CGroup: /system.slice/docker.service
└─3811 /usr/bin/dockerd -H fd:// --containerd=/run/containerd/containerd.sock

[lj@localhost test-network]$ ./network.sh up
Using docker and docker-compose
Starting nodes with CLI timeout of '5' tries and CLI delay of '3' seconds and using database 'leveldb'
LOCAL_VERSION=2.3.0
DOCKER_IMAGE_VERSION=2.3.0
Creating network "fabric_test" with the default driver
Creating volume "compose_orderer.example.com" with default driver
Creating volume "compose_peer0.org1.example.com" with default driver
Creating volume "compose_peer0.org2.example.com" with default driver
Creating orderer.example.com ... done
Creating peer0.org1.example.com ... done
Creating peer0.org2.example.com ... done
Creating cli ... done
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
35151ab82b4e hyperledger/fabric-tools:latest "/bin/bash" 1 second ago Up Less than a second cli
9b54f5604bdf hyperledger/fabric-peer:latest "peer node start" 2 seconds ago Up Less than a second 0.0.0.0:9051->9051/tcp, :::9051->9051/tcp, 7051/tcp, 0.0.0.0:9445->9445/tcp, :::9445->9445/tcp peer0.org2.example.com
300dcd9ba537 hyperledger/fabric-peer:latest "peer node start" 2 seconds ago Up Less than a second 0.0.0.0:7051->7051/tcp, :::7051->7051/tcp, 0.0.0.0:9444->9444/tcp, :::9444->9444/tcp peer0.org1.example.com
53f5bde2ac2f hyperledger/fabric-orderer:latest "orderer" 2 seconds ago Up Less than a second 0.0.0.0:7050->7050/tcp, :::7050->7050/tcp, 0.0.0.0:7053->7053/tcp, :::7053->7053/tcp, 0.0.0.0:9443->9443/tcp, :::9443->9443/tcp orderer.example.com