docker info命令
输出显示:
Server: ERROR: Cannot connect to the Docker daemon at unix:///var/run/docker.sock. Is the docker daemon running?
本次解决问题的资料:
关于Docker启动报错:docker.socket: Failed to listen on sockets: Address already in use
https://www.cnblogs.com/Conwie/p/14462232.html
不能解决的网上资料:
网上查了一堆资料,没找到解决方法
编辑 vim /etc/docker/daemon.json (解决不了) https://blog.csdn.net/sdrfengmi/article/details/87929593 写在docker后重新安装 (不考虑) 添加docker用户组 (已经有用户组了) https://www.dazhuanlan.com/2019/12/31/5e0b0af5a3191/ 还有修改 vi /etc/sysconfig/selinux文件信息的(不考虑) https://blog.csdn.net/qq_40996741/article/details/98473966
然后想着先停掉docker服务。
停服务时候报错了
systemctl stop docker.service
Warning: Stopping docker.service, but it can still be activated by:
docker.socket
docker服务还是存活了,根据docker.socket文件。
接着启动docker服务
systemctl start docker.service
错误信息如下:
A dependency job for docker.service failed. See 'journalctl -xe' for details
systemctl status docker.service
查看服务状态:
● docker.service - Docker Application Container Engine Loaded: loaded (/usr/lib/systemd/system/docker.service; enabled; vendor preset: disabled) Active: inactive (dead) since Tue 2021-06-08 09:53:44 CST; 10min ago Docs: https://docs.docker.com Main PID: 4695 (code=exited, status=0/SUCCESS) Jun 08 09:53:42 VM-0-13-centos dockerd[4695]: time="2021-06-08T09:53:42.8864784..." Jun 08 09:53:42 VM-0-13-centos dockerd[4695]: time="2021-06-08T09:53:42.9251783..." Jun 08 09:53:44 VM-0-13-centos dockerd[4695]: time="2021-06-08T09:53:44.9135121..." Jun 08 09:53:44 VM-0-13-centos systemd[1]: Stopped Docker Application Container.... Jun 08 09:57:52 VM-0-13-centos systemd[1]: Dependency failed for Docker Applica.... Jun 08 09:57:52 VM-0-13-centos systemd[1]: Job docker.service/start failed with.... Jun 08 10:01:29 VM-0-13-centos systemd[1]: Dependency failed for Docker Applica.... Jun 08 10:01:29 VM-0-13-centos systemd[1]: Job docker.service/start failed with.... Jun 08 10:03:09 VM-0-13-centos systemd[1]: Dependency failed for Docker Applica.... Jun 08 10:03:09 VM-0-13-centos systemd[1]: Job docker.service/start failed with.... Hint: Some lines were ellipsized, use -l to show in full
看不出来错误信息
然后使用 journalctl -xe 命令查看系统日志信息
主要就是红框里
Jun 08 10:08:41 VM-0-13-centos systemd[1]: docker.socket failed to listen on sockets: Address already in use
Jun 08 10:08:41 VM-0-13-centos systemd[1]: Failed to listen on Docker Socket for the API.
错误提示:监听socket时,发现地址已经被使用。
然后去查看 /var/run/ 目录的docker文件
发现docker.sock 文件变成的目录 docker.dock/
删除这个目录就可以解决问题
rm -rf /var/run/docker.sock/
然后能正常启动docker服务
systemctl restart docker