ERROR: Cannot connect to the Docker daemon at unix:///var/run/docker.sock.

发布于:2025-06-25 ⋅ 阅读:(16) ⋅ 点赞:(0)

(base) root@node15:~# docker info
Client:
 Version:    26.1.3
 Context:    default
 Debug Mode: false
 Plugins:
  compose: Docker Compose (Docker Inc.)
    Version:  v2.32.4
    Path:     /usr/libexec/docker/cli-plugins/docker-compose

Server:
ERROR: Cannot connect to the Docker daemon at unix:///var/run/docker.sock. Is the docker daemon running?
errors pretty printing info
(base) root@node15:~# cat /etc/docker/daemon.json
{
    "runtimes": {
        "nvidia": {
            "path": "nvidia-container-runtime",
            "runtimeArgs": []
        }
    },
     "registry-mirrors": [
         "https://registry.docker-cn.com",
         "https://docker.m.daocloud.io",
         "https://dockerproxy.com",
         "https://docker.mirrors.ustc.edu.cn",
         "https://docker.nju.edu.cn",
         "https://iju9kaj2.mirror.aliyuncs.com",
         "http://hub-mirror.c.163.com",
         "https://cr.console.aliyun.com",
         "https://hub.docker.com",
         "http://mirrors.ustc.edu.cn"
     ]

}

(base) root@node15:~# date
2025年 06月 24日 星期二 11:03:43 CST
(base) root@node15:~# 
(base) root@node15:~# 
(base) root@node15:~# 
(base) root@node15:~# 
(base) root@node15:~# 
(base) root@node15:~# ntpdate -d ntp.aliyun.com
Command 'ntpdate' not found, but can be installed with:
apt install ntpdate         # version 1:4.2.8p15+dfsg-1ubuntu2, or
apt install ntpsec-ntpdate  # version 1.2.1+dfsg1-4
(base) root@node15:~# ntpdate ntp.aliyun.com
Command 'ntpdate' not found, but can be installed with:
apt install ntpdate         # version 1:4.2.8p15+dfsg-1ubuntu2, or
apt install ntpsec-ntpdate  # version 1.2.1+dfsg1-4
(base) root@node15:~# apt install ntpdate
Reading package lists... Done
Building dependency tree... Done
Reading state information... Done
The following packages were automatically installed and are no longer required:
  libflashrom1 libftdi1-2 libllvm13
Use 'apt autoremove' to remove them.
The following NEW packages will be installed:
  ntpdate
0 upgraded, 1 newly installed, 0 to remove and 95 not upgraded.
11 not fully installed or removed.
Need to get 51.5 kB of archives.
After this operation, 178 kB of additional disk space will be used.
Get:1 http://cn.archive.ubuntu.com/ubuntu jammy/universe amd64 ntpdate amd64 1:4.2.8p15+dfsg-1ubuntu2 [51.5 kB]
Fetched 51.5 kB in 1s (82.7 kB/s)  
Selecting previously unselected package ntpdate.
(Reading database ... 230423 files and directories currently installed.)
Preparing to unpack .../ntpdate_1%3a4.2.8p15+dfsg-1ubuntu2_amd64.deb ...
Unpacking ntpdate (1:4.2.8p15+dfsg-1ubuntu2) ...
Setting up vim (2:8.2.3995-1ubuntu2.23) ...
update-alternatives: error: cannot stat file '/etc/alternatives/vimdiff': Invalid argument
dpkg: error processing package vim (--configure):
 installed vim package post-installation script subprocess returned error exit status 2
Setting up yaru-theme-gnome-shell (22.04.5) ...
update-alternatives: error: cannot stat file '/etc/alternatives/gdm-theme.gresource': Invalid argument
dpkg: error processing package yaru-theme-gnome-shell (--configure):
 installed yaru-theme-gnome-shell package post-installation script subprocess returned error exit status 2
Setting up iptables (1.8.7-1ubuntu5.2) ...
update-alternatives: error: cannot stat file '/etc/alternatives/iptables': Invalid argument
dpkg: error processing package iptables (--configure):
 installed iptables package post-installation script subprocess returned error exit status 2
dpkg: dependency problems prevent configuration of ufw:
 ufw depends on iptables; however:
  Package iptables is not configured yet.

dpkg: error processing package ufw (--configure):
 dependency problems - leaving unconfigured
Setting up vim-tiny (2:8.2.3995-1ubuntu2.23) ...
No apport report written because MaxReports is reached already
                                                              update-alternatives: error: cannot stat file '/etc/alternatives/rview': Invalid argument
dpkg: error processing package vim-tiny (--configure):
 installed vim-tiny package post-installation script subprocess returned error exit status 2
No apport report written because MaxReports is reached already
                                                              Setting up ntpdate (1:4.2.8p15+dfsg-1ubuntu2) ...
Setting up plymouth-theme-ubuntu-text (0.9.5+git20211018-1ubuntu3) ...
update-alternatives: error: cannot stat file '/etc/alternatives/text.plymouth': Invalid argument
dpkg: error processing package plymouth-theme-ubuntu-text (--configure):
 installed plymouth-theme-ubuntu-text package post-installation script subprocess returned error exit status 2
Setting up gdm3 (42.0-1ubuntu7.22.04.4) ...
No apport report written because MaxReports is reached already
                                                              update-alternatives: error: cannot stat file '/etc/alternatives/gdm-smartcard': Invalid argument
dpkg: error processing package gdm3 (--configure):
 installed gdm3 package post-installation script subprocess returned error exit status 2
No apport report written because MaxReports is reached already
                                                              Setting up xdg-utils (1.1.3-4.1ubuntu3~22.04.1) ...
update-alternatives: error: cannot stat file '/etc/alternatives/open': Invalid argument
dpkg: error processing package xdg-utils (--configure):
 installed xdg-utils package post-installation script subprocess returned error exit status 2
No apport report written because MaxReports is reached already
                                                              dpkg: dependency problems prevent configuration of ubuntu-desktop:
 ubuntu-desktop depends on gdm3; however:
  Package gdm3 is not configured yet.

dpkg: error processing package ubuntu-desktop (--configure):
 dependency problems - leaving unconfigured
No apport report written because MaxReports is reached already
                                                              dpkg: dependency problems prevent configuration of ubuntu-minimal:
 ubuntu-minimal depends on vim-tiny; however:
  Package vim-tiny is not configured yet.

dpkg: error processing package ubuntu-minimal (--configure):
 dependency problems - leaving unconfigured
No apport report written because MaxReports is reached already
                                                              dpkg: dependency problems prevent configuration of ubuntu-desktop-minimal:
 ubuntu-desktop-minimal depends on gdm3; however:
  Package gdm3 is not configured yet.

dpkg: error processing package ubuntu-desktop-minimal (--configure):
 dependency problems - leaving unconfigured
No apport report written because MaxReports is reached already
                                                              Processing triggers for man-db (2.10.2-1) ...
Errors were encountered while processing:
 vim
 yaru-theme-gnome-shell
 iptables
 ufw
 vim-tiny
 plymouth-theme-ubuntu-text
 gdm3
 xdg-utils
 ubuntu-desktop
 ubuntu-minimal
 ubuntu-desktop-minimal
E: Sub-process /usr/bin/dpkg returned an error code (1)
(base) root@node15:~# ntpdate ntp.aliyun.com
24 Jun 11:01:30 ntpdate[1786]: step time server 203.107.6.88 offset -193.156156 sec
(base) root@node15:~# date
2025年 06月 24日 星期二 11:01:32 CST
(base) root@node15:~# date
2025年 06月 24日 星期二 11:01:34 CST
(base) root@node15:~# 
(base) root@node15:~# 
(base) root@node15:~# docker ps
Cannot connect to the Docker daemon at unix:///var/run/docker.sock. Is the docker daemon running?
(base) root@node15:~# 
(base) root@node15:~# 
(base) root@node15:~# systemctl status docker
○ docker.service - Docker Application Container Engine
     Loaded: loaded (/etc/systemd/system/docker.service; disabled; vendor preset: enabled)
     Active: inactive (dead)
       Docs: https://docs.docker.com
(base) root@node15:~# systemctl start docker
Job for docker.service failed because the control process exited with error code.
See "systemctl status docker.service" and "journalctl -xeu docker.service" for details.
(base) root@node15:~# journalctl -xeu docker.service
6月 24 11:02:59 node15 dockerd[1803]: failed to start daemon: failed to dial "/run/containerd/containerd.sock": failed to dial "/run/containerd/containerd.sock": context >
6月 24 11:02:59 node15 systemd[1]: docker.service: Main process exited, code=exited, status=1/FAILURE
░░ Subject: Unit process exited
░░ Defined-By: systemd
░░ Support: http://www.ubuntu.com/support
░░ 
░░ An ExecStart= process belonging to unit docker.service has exited.
░░ 
░░ The process' exit code is 'exited' and its exit status is 1.
6月 24 11:02:59 node15 systemd[1]: docker.service: Failed with result 'exit-code'.
░░ Subject: Unit failed
░░ Defined-By: systemd
░░ Support: http://www.ubuntu.com/support
░░ 
░░ The unit docker.service has entered the 'failed' state with result 'exit-code'.
6月 24 11:02:59 node15 systemd[1]: Failed to start Docker Application Container Engine.
░░ Subject: A start job for unit docker.service has failed
░░ Defined-By: systemd
░░ Support: http://www.ubuntu.com/support
░░ 
░░ A start job for unit docker.service has finished with a failure.
░░ 
░░ The job identifier is 1042 and the job result is failed.
6月 24 11:02:59 node15 systemd[1]: docker.service: Consumed 1.164s CPU time.
░░ Subject: Resources consumed by unit runtime
░░ Defined-By: systemd
░░ Support: http://www.ubuntu.com/support
░░ 
░░ The unit docker.service completed and consumed the indicated resources.
6月 24 11:03:01 node15 systemd[1]: docker.service: Scheduled restart job, restart counter is at 1.
░░ Subject: Automatic restarting of a unit has been scheduled
░░ Defined-By: systemd
░░ Support: http://www.ubuntu.com/support
░░ 
░░ Automatic restarting of the unit docker.service has been scheduled, as the result for
░░ the configured Restart= setting for the unit.
6月 24 11:03:01 node15 systemd[1]: Stopped Docker Application Container Engine.
░░ Subject: A stop job for unit docker.service has finished
░░ Defined-By: systemd
░░ Support: http://www.ubuntu.com/support
░░ 
░░ A stop job for unit docker.service has finished.
░░ 
░░ The job identifier is 1221 and the job result is done.
6月 24 11:03:01 node15 systemd[1]: docker.service: Consumed 1.164s CPU time.
░░ Subject: Resources consumed by unit runtime
░░ Defined-By: systemd
░░ Support: http://www.ubuntu.com/support
░░ 
░░ The unit docker.service completed and consumed the indicated resources.
6月 24 11:03:01 node15 systemd[1]: Starting Docker Application Container Engine...
░░ Subject: A start job for unit docker.service has begun execution
░░ Defined-By: systemd
░░ Support: http://www.ubuntu.com/support
░░ 
░░ A start job for unit docker.service has begun execution.
░░ 
░░ The job identifier is 1221.
6月 24 11:03:01 node15 dockerd[1915]: time="2025-06-24T11:03:01.657708068+08:00" level=info msg="Starting up"
(base) root@node15:~# systemctl status containerd
○ containerd.service - containerd container runtime
     Loaded: loaded (/etc/systemd/system/containerd.service; disabled; vendor preset: enabled)
     Active: inactive (dead)
       Docs: https://containerd.io
(base) root@node15:~# systemctl start containerd
(base) root@node15:~# systemctl enable containerd

Failed to enable unit: File /etc/systemd/system/multi-user.target.wants/containerd.service already exists.
(base) root@node15:~# ls -l /run/containerd/containerd.sock
srw-rw---- 1 root root 0  6月 24 11:05 /run/containerd/containerd.sock
(base) root@node15:~# systemctl restart containerd
(base) root@node15:~# systemctl restart docker
(base) root@node15:~# systemctl status containerd
● containerd.service - containerd container runtime
     Loaded: loaded (/etc/systemd/system/containerd.service; disabled; vendor preset: enabled)
     Active: active (running) since Tue 2025-06-24 11:06:10 CST; 30s ago
       Docs: https://containerd.io
    Process: 2768 ExecStartPre=/sbin/modprobe overlay (code=exited, status=0/SUCCESS)
   Main PID: 2769 (containerd)
      Tasks: 36
     Memory: 139.2M
        CPU: 541ms
     CGroup: /system.slice/containerd.service
             ├─2769 /usr/bin/containerd
             └─3354 /usr/bin/containerd-shim-runc-v2 -namespace moby -id 4738504e237081fc3cc0e3628c0b813ddc5620ccbbe7ba543231b4213fd66f14 -address /run/containerd/contain>

6月 24 11:06:10 node15 containerd[2769]: time="2025-06-24T11:06:10.473563852+08:00" level=info msg=serving... address=/run/containerd/containerd.sock
6月 24 11:06:10 node15 containerd[2769]: time="2025-06-24T11:06:10.473672038+08:00" level=info msg="containerd successfully booted in 0.071645s"
6月 24 11:06:10 node15 systemd[1]: Started containerd container runtime.
6月 24 11:06:25 node15 containerd[2769]: time="2025-06-24T11:06:25.579644039+08:00" level=info msg="shim disconnected" id=4738504e237081fc3cc0e3628c0b813ddc5620ccbbe7ba54>
6月 24 11:06:25 node15 containerd[2769]: time="2025-06-24T11:06:25.579777303+08:00" level=warning msg="cleaning up after shim disconnected" id=4738504e237081fc3cc0e3628c0>
6月 24 11:06:25 node15 containerd[2769]: time="2025-06-24T11:06:25.579801806+08:00" level=info msg="cleaning up dead shim" namespace=moby
6月 24 11:06:26 node15 containerd[2769]: time="2025-06-24T11:06:26.324863566+08:00" level=info msg="loading plugin \"io.containerd.event.v1.publisher\"..." runtime=io.con>
6月 24 11:06:26 node15 containerd[2769]: time="2025-06-24T11:06:26.325486736+08:00" level=info msg="loading plugin \"io.containerd.internal.v1.shutdown\"..." runtime=io.c>
6月 24 11:06:26 node15 containerd[2769]: time="2025-06-24T11:06:26.325501690+08:00" level=info msg="loading plugin \"io.containerd.ttrpc.v1.task\"..." runtime=io.containe>
6月 24 11:06:26 node15 containerd[2769]: time="2025-06-24T11:06:26.325587473+08:00" level=info msg="loading plugin \"io.containerd.ttrpc.v1.pause\"..." runtime=io.contain>
(base) root@node15:~# systemctl status docker
● docker.service - Docker Application Container Engine
     Loaded: loaded (/etc/systemd/system/docker.service; disabled; vendor preset: enabled)
     Active: active (running) since Tue 2025-06-24 11:06:26 CST; 19s ago
       Docs: https://docs.docker.com
   Main PID: 2885 (dockerd)
      Tasks: 147
     Memory: 64.7M
        CPU: 1.328s
     CGroup: /system.slice/docker.service
             ├─2885 /usr/bin/dockerd --containerd=/run/containerd/containerd.sock
             ├─3200 /usr/bin/docker-proxy -proto tcp -host-ip 0.0.0.0 -host-port 8888 -container-ip 192.168.176.2 -container-port 8888
             ├─3219 /usr/bin/docker-proxy -proto tcp -host-ip :: -host-port 8888 -container-ip 192.168.176.2 -container-port 8888
             ├─3282 /usr/bin/docker-proxy -proto tcp -host-ip 0.0.0.0 -host-port 8080 -container-ip 192.168.176.2 -container-port 8080
             ├─3295 /usr/bin/docker-proxy -proto tcp -host-ip :: -host-port 8080 -container-ip 192.168.176.2 -container-port 8080
             ├─3310 /usr/bin/docker-proxy -proto tcp -host-ip 0.0.0.0 -host-port 8003 -container-ip 192.168.176.2 -container-port 8003
             ├─3318 /usr/bin/docker-proxy -proto tcp -host-ip :: -host-port 8003 -container-ip 192.168.176.2 -container-port 8003
             ├─3331 /usr/bin/docker-proxy -proto tcp -host-ip 0.0.0.0 -host-port 8022 -container-ip 192.168.176.2 -container-port 22
             └─3339 /usr/bin/docker-proxy -proto tcp -host-ip :: -host-port 8022 -container-ip 192.168.176.2 -container-port 22

6月 24 11:06:25 node15 systemd[1]: Starting Docker Application Container Engine...
6月 24 11:06:25 node15 dockerd[2885]: time="2025-06-24T11:06:25.924106830+08:00" level=info msg="Starting up"
6月 24 11:06:25 node15 dockerd[2885]: time="2025-06-24T11:06:25.956622024+08:00" level=info msg="[graphdriver] using prior storage driver: overlay2"
6月 24 11:06:26 node15 dockerd[2885]: time="2025-06-24T11:06:26.014334955+08:00" level=info msg="Loading containers: start."
6月 24 11:06:26 node15 dockerd[2885]: time="2025-06-24T11:06:26.186376217+08:00" level=info msg="Default bridge (docker0) is assigned with an IP address 172.17.0.0/16. Da>
6月 24 11:06:26 node15 dockerd[2885]: time="2025-06-24T11:06:26.747133275+08:00" level=info msg="Loading containers: done."
6月 24 11:06:26 node15 dockerd[2885]: time="2025-06-24T11:06:26.763773321+08:00" level=info msg="Docker daemon" commit="26.1.3-0ubuntu1~22.04.1" containerd-snapshotter=fa>
6月 24 11:06:26 node15 dockerd[2885]: time="2025-06-24T11:06:26.763906249+08:00" level=info msg="Daemon has completed initialization"
6月 24 11:06:26 node15 dockerd[2885]: time="2025-06-24T11:06:26.794829925+08:00" level=info msg="API listen on /var/run/docker.sock"
6月 24 11:06:26 node15 systemd[1]: Started Docker Application Container Engine.