今天打开centos7,由于没设置开机自启,当我启动docker时,发现与docker有关的命令都会报错,百度过,说什么重装docker啥的,我都试过,但是还是解决不了问题,下面我贴出问题集:

1. 例如我查看版本信息

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

 

 

 

2.重启容器

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

 

 

 

3. systemctl status docker 查看docker状态也发现错误:

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

 

 

 


最后解决问题方法是:
1.进入 /etc/docker,没有daemon.json文件就自己新建一个:

cd /etc/docker

2.编辑daemon.json文件:
加入这段代码:

{
"registry-mirrors": ["https://registry.docker-cn.com"]
}

 

3.然后重启docker:

systemctl restart docker.service

相关文章:

  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2021-10-28
  • 2021-07-21
猜你喜欢
  • 2021-11-18
  • 2021-07-02
相关资源
相似解决方案