合 docker启动报错 Cannot connect to the Docker daemon at unix:///var/run/docker.sock. Is the docker daemon running
现象
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 | [root@kylinosv10sp3 /]# docker ps Cannot connect to the Docker daemon at unix:///var/run/docker.sock. Is the docker daemon running? [root@kylinosv10sp3 /]# [root@kylinosv10sp3 /]# 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 Thu 2023-08-17 14:34:32 CST; 1min 37s ago Docs: https://docs.docker.com Main PID: 354 (dockerd) Tasks: 17 Memory: 25.9M CGroup: /docker/d974bcb5da4ab13d9dcb098ee7ecd52905a584b85202cb970900544c6aa12fe5/system.slice/docker.service └─354 /usr/bin/dockerd -H fd:// --containerd=/run/containerd/containerd.sock Aug 17 14:34:32 kylinosv10sp3 dockerd[354]: time="2023-08-17T14:34:32.190117792+08:00" level=info msg="Loading containers: start." Aug 17 14:34:32 kylinosv10sp3 dockerd[354]: time="2023-08-17T14:34:32.193041969+08:00" level=warning msg="Running modprobe bridge br_netfilter failed with message: modprobe: WARNING: Module bridge not found in directory /lib/modules/3.10.0-1160.80.1.el7.x86_64\nmodprobe: WARNING: Module br_netfilter not found in directory /lib/modules/3.10.0-1160.80.1.el7.x86_64\n, error: exit status 1" Aug 17 14:34:32 kylinosv10sp3 dockerd[354]: time="2023-08-17T14:34:32.354057363+08:00" level=info msg="Default bridge (docker0) is assigned with an IP address 172.17.0.0/16. Daemon option --bip can be used to set a preferred IP address" Aug 17 14:34:32 kylinosv10sp3 dockerd[354]: time="2023-08-17T14:34:32.425518855+08:00" level=info msg="Loading containers: done." Aug 17 14:34:32 kylinosv10sp3 dockerd[354]: time="2023-08-17T14:34:32.439504909+08:00" level=warning msg="WARNING: bridge-nf-call-iptables is disabled" Aug 17 14:34:32 kylinosv10sp3 dockerd[354]: time="2023-08-17T14:34:32.439536044+08:00" level=warning msg="WARNING: bridge-nf-call-ip6tables is disabled" Aug 17 14:34:32 kylinosv10sp3 dockerd[354]: time="2023-08-17T14:34:32.439558605+08:00" level=info msg="Docker daemon" commit=a61e2b4 graphdriver=vfs version=24.0.5 Aug 17 14:34:32 kylinosv10sp3 dockerd[354]: time="2023-08-17T14:34:32.439609937+08:00" level=info msg="Daemon has completed initialization" Aug 17 14:34:32 kylinosv10sp3 dockerd[354]: time="2023-08-17T14:34:32.486112207+08:00" level=info msg="API listen on /run/docker.sock" Aug 17 14:34:32 kylinosv10sp3 systemd[1]: Started Docker Application Container Engine. [root@kylinosv10sp3 /]# |
解决
保证如下3个文件都存在,且时间一样,run目录下的docker.sock文件有docker属性:
1 2 3 4 5 6 7 8 9 10 11 | ll /run/containerd/containerd.sock ll /var/run/docker.sock ll /run/docker.sock ln -sf /run/docker.sock /var/run/docker.sock systemctl status docker systemctl status docker.socket systemctl start docker systemctl start docker.socket |