服务器上被新来的小伙伴不知道弄了啥,docker没法用了,具体报错如下:

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

找了找解决方法,其实就是关闭docker,再重新启动,具体如下:

service docker stop
systemctl stop docker
systemctl start docker
# 检查发现docker又可以使用了。。。。
docker ps -a 

一些常用的docker命令:

  • Docker启动命令1: sudo systemctl start docker

  • Docker启动命令2: sudo service docker start

  • Docker重启命令1: sudo systemctl restart docker

  • Docker重启命令2: sudo service docker restart

  • docker关闭命令1: sudo systemctl stop docker

  • docker关闭命令2: sudo service docker stop

  • 守护进程重启: sudo systemctl daemon-reload

  • 设置Docker开机自启动方式1: systemctl enable docker.service

  • 设置Docker开机自启动方式2: chkconfig docker on

  • 关闭Docker开机启动: systemctl disable docker.service

  • 查看是否设置开机启动列表: systemctl list-unit-files | grep enable

参考链接:

  1. https://blog.csdn.net/lihongdou/article/details/103307015?utm_medium=distribute.pc_relevant.none-task-blog-title-2&spm=1001.2101.3001.4242
Logo

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

更多推荐