当docker ps出现Cannot connect to the Docker daemon at unix:///var/run/docker.sock. Is the docker daemon running以下报错时,首先
systemctl status docker
查看docker服务的状态如果处于关闭状态则需要启动docker服务
systemctl start docker
如果服务是启动状态docker ps还是报这个错
vim /usr/lib/systemd/system/docker.service
[Unit]
Description=Docker Application Container Engine
Documentation=https://docs.docker.com
After=network-online.target docker.socket firewalld.service containerd.service time-set.target
Wants=network-online.target containerd.service
Requires=docker.socket
[Service]
Type=notify
# the default is not to use systemd for cgroups because the delegate issues still
# exists and systemd currently does not support the cgroup feature set required
# for containers run by docker
ExecStart=/usr/bin/dockerd -H fd:// --containerd=/run/containerd/containerd.sock
#此处的sock文件有两处确认一下自己的在/run下面还是/container下面
ExecReload=/bin/kill -s HUP $MAINPID
如果路径ok,那就是docker.socket进程没有关掉文章来源:https://www.toymoban.com/news/detail-720808.html
systemctl stop docker.socket #停掉docker.socket进程
systemctl stop docker #同时把docker也停掉
重新启动服务即可文章来源地址https://www.toymoban.com/news/detail-720808.html
到了这里,关于Cannot connect to the Docker daemon at unix:///var/run/docker.sock. Is the docker daemon running的文章就介绍完了。如果您还想了解更多内容,请在右上角搜索TOY模板网以前的文章或继续浏览下面的相关文章,希望大家以后多多支持TOY模板网!