1.启动时报错查看日志发现
# journalctl -xe
Failed to listen on Docker Socket for the API.
查找socket这个配置文件,修改如下
# find / -name docker.socket
/etc/systemd/system/sockets.target.wants/docker.socket
/lib/systemd/system# vim docker.socket
[Unit]
Description=Docker Socket for the API
[Socket]
ListenStream=/var/run/docker.sock
SocketMode=0660
SocketUser=root
SocketGroup=root # 这里原来是docker改成root即可,保存退出
[Install]
WantedBy=sockets.target
# systemctl enable docker.service
# systemctl enable docker.socket
再次重启docker,OK
docker.service - Docker Application Container Engine
Loaded: loaded (/lib/systemd/system/docker.service; enabled; vendor preset: enabled)
Active: active (running) since Mar 2021-03-25 13:04:49 CST; 4s ago
Docs: https://docs.docker.com
Main PID: 35283 (dockerd)
Tasks: 9
CGroup: /system.slice/docker.service
└─35283 /usr/bin/dockerd -H fd:// --containerd=/run/containerd/containerd.sock
March 25 13:04:49 harbor-https-144 dockerd[35283]: time="2021-03-25T13:04:49.033752207+08:00" level=info msg="ClientConn switching balancer to \"pick_first\"" m
March 25 13:04:49 harbor-https-144 dockerd[35283]: time="2021-03-25T13:04:49.120893423+08:00" level=warning msg="Your kernel does not support swap memory limit"
March 25 13:04:49 harbor-https-144 dockerd[35283]: time="2021-03-25T13:04:49.120928599+08:00" level=warning msg="Your kernel does not support CPU realtime sched
March 25 13:04:49 harbor-https-144 dockerd[35283]: time="2021-03-25T13:04:49.121049967+08:00" level=info msg="Loading containers: start."
March 25 13:04:49 harbor-https-144 dockerd[35283]: time="2021-03-25T13:04:49.395286964+08:00" level=info msg="Default bridge (docker0) is assigned with an IP ad
March 25 13:04:49 harbor-https-144 dockerd[35283]: time="2021-03-25T13:04:49.600646552+08:00" level=info msg="Loading containers: done."
March 25 13:04:49 harbor-https-144 dockerd[35283]: time="2021-03-25T13:04:49.640003408+08:00" level=info msg="Docker daemon" commit=8728dd2 graphdriver(s)=overl
March 25 13:04:49 harbor-https-144 dockerd[35283]: time="2021-03-25T13:04:49.640101482+08:00" level=info msg="Daemon has completed initialization"
March 25 13:04:49 harbor-https-144 dockerd[35283]: time="2021-03-25T13:04:49.704265015+08:00" level=info msg="API listen on /var/run/docker.sock"
March 25 13:04:49 harbor-https-144 systemd[1]: Started Docker Application Container Engine.