centos7版本以上出现这个错误

 

Cannot connect to the Docker daemon at unix:///var/run/docker.sock. Is the docker daemon running?

配置dockerhost

sudo vim /etc/profile.d/docker.sh

export DOCKER_HOST=tcp://0.0.0.0:2375

 

保存设置的内容

source /etc/profile
source /etc/bashrc

设置启动文件

sudo vim /lib/systemd/system/docker.service

ExecStart=/usr/bin/dockerd
修改为
ExecStart=/usr/bin/dockerd -H tcp://0.0.0.0:2375 -H unix:///var/run/docker.sock -H tcp://0.0.0.0:7654

重新加载配置和启动

sudo systemctl daemon-reload 
sudo systemctl restart docker.service

查看docker 

docker version
[root@iz2zed10hr1jufjrlslj44z /]# docker info
Containers: 0
 Running: 0
 Paused: 0
 Stopped: 0
Images: 0
Server Version: 18.09.0
Storage Driver: overlay2
 Backing Filesystem: extfs
 Supports d_type: true
 Native Overlay Diff: false
Logging Driver: json-file
Cgroup Driver: cgroupfs
Plugins:
 Volume: local
 Network: bridge host macvlan null overlay
 Log: awslogs fluentd gcplogs gelf journald json-file local logentries splunk syslog
Swarm: inactive
Runtimes: runc
Default Runtime: runc
Init Binary: docker-init
containerd version: c4446665cb9c30056f4998ed953e6d4ff22c7c39
runc version: 4fc53a81fb7c994640722ac585fa9ca548971871
init version: fec3683
Security Options:

 

Logo

权威|前沿|技术|干货|国内首个API全生命周期开发者社区

更多推荐