如题,使用docker时提示如下操作。可能是服务器重启而docker未重启造成。
Cannot connect to the Docker daemon at unix:///var/run/docker.sock. Is the docker daemon running?
可使用如下操作查看docker状态。
systemctl status docker
● docker.service - Docker Application Container Engine
Loaded: loaded (/usr/lib/systemd/system/docker.service; disabled; vendor preset: disabled)
Active: inactive (dead)
Docs: https://docs.docker.com
状态为:inactive,说明需要重启。
systemctl start docker
再次使用上上一步命令查看docker状态
systemctl status docker
● docker.service - Docker Application Container Engine
Loaded: loaded (/usr/lib/systemd/system/docker.service; disabled; vendor preset: disabled)
Active: active (running) since Wed 2022-01-12 10:01:36 CST; 2min 33s ago
Docs: https://docs.docker.com
Main PID: 1646 (dockerd)
Tasks: 9
Memory: 163.1M
CGroup: /system.slice/docker.service
└─1646 /usr/bin/dockerd -H fd:// --containerd=/run/containerd/containerd.sock
此时,发现dockers已经正常运行。
附录:
如果docker未安装,可先使用如下命令安装docker。(适用于centos)
sudo yum install docker
参见: