在将Ubuntu从20.10升级到21.04之后,似乎正在运行:
/run/docker.sock但是码头客户去找它:
/var/run/docker.sock我怎么才能解决这个问题?
详细说明一下,运行我得到的docker命令:
$ docker ps
Cannot connect to the Docker daemon at unix:///var/run/docker.sock. Is the docker daemon running?但是,对接服务似乎是在另一个位置(退出var)中使用坞插座运行的:
$ sudo systemctl status docker
● docker.service - Docker Application Container Engine
Loaded: loaded (/lib/systemd/system/docker.service; enabled; vendor preset: enabled)
Active: active (running) since Mon 2021-05-17 10:14:49 CEST; 5s ago
TriggeredBy: ● docker.socket
Docs: https://docs.docker.com
Main PID: 10163 (dockerd)
Tasks: 18
Memory: 40.5M
CGroup: /system.slice/docker.service
└─10163 /usr/bin/dockerd -H fd:// --containerd=/run/containerd/containerd.sock
may 17 10:14:49 xps-laptop dockerd[10163]: time="2021-05-17T10:14:49.599580310+02:00" level=warning msg="Your kernel does not support CPU realtime scheduler"
may 17 10:14:49 xps-laptop dockerd[10163]: time="2021-05-17T10:14:49.599624934+02:00" level=warning msg="Your kernel does not support cgroup blkio weight"
may 17 10:14:49 xps-laptop dockerd[10163]: time="2021-05-17T10:14:49.599642841+02:00" level=warning msg="Your kernel does not support cgroup blkio weight_device"
may 17 10:14:49 xps-laptop dockerd[10163]: time="2021-05-17T10:14:49.599907138+02:00" level=info msg="Loading containers: start."
may 17 10:14:49 xps-laptop dockerd[10163]: time="2021-05-17T10:14:49.740160234+02:00" level=info msg="Default bridge (docker0) is assigned with an IP address 172.17.0.0/16. Daemon option --bip can be use>
may 17 10:14:49 xps-laptop dockerd[10163]: time="2021-05-17T10:14:49.838137738+02:00" level=info msg="Loading containers: done."
may 17 10:14:49 xps-laptop dockerd[10163]: time="2021-05-17T10:14:49.854381886+02:00" level=info msg="Docker daemon" commit=20.10.2-0ubuntu2 graphdriver(s)=overlay2 version=20.10.2
may 17 10:14:49 xps-laptop dockerd[10163]: time="2021-05-17T10:14:49.854462072+02:00" level=info msg="Daemon has completed initialization"
may 17 10:14:49 xps-laptop systemd[1]: Started Docker Application Container Engine.
may 17 10:14:49 xps-laptop dockerd[10163]: time="2021-05-17T10:14:49.879020578+02:00" level=info msg="API listen on /run/docker.sock"编辑(/lib/systemd/system/docker.socket内容):
$ cat /lib/systemd/system/docker.socket
[Unit]
Description=Docker Socket for the API
[Socket]
ListenStream=/var/run/docker.sock
SocketMode=0660
SocketUser=root
SocketGroup=docker
[Install]
WantedBy=sockets.target编辑2(/lib/systemd/system/docker.service的内容):
$ cat /lib/systemd/system/docker.service
[Unit]
Description=Docker Application Container Engine
Documentation=https://docs.docker.com
After=network-online.target firewalld.service containerd.service
Wants=network-online.target
Requires=docker.socket
Wants=containerd.service
[Service]
Type=notify
# the default is not to use systemd for cgroups because the delegate issues still
# exists and systemd currently does not support the cgroup feature set required
# for containers run by docker
ExecStart=/usr/bin/dockerd -H fd:// --containerd=/run/containerd/containerd.sock
ExecReload=/bin/kill -s HUP $MAINPID
TimeoutSec=0
RestartSec=2
Restart=always
# Note that StartLimit* options were moved from "Service" to "Unit" in systemd 229.
# Both the old, and new location are accepted by systemd 229 and up, so using the old location
# to make them work for either version of systemd.
StartLimitBurst=3
# Note that StartLimitInterval was renamed to StartLimitIntervalSec in systemd 230.
# Both the old, and new name are accepted by systemd 230 and up, so using the old name to make
# this option work for either version of systemd.
StartLimitInterval=60s
# Having non-zero Limit*s causes performance problems due to accounting overhead
# in the kernel. We recommend using cgroups to do container-local accounting.
LimitNOFILE=infinity
LimitNPROC=infinity
LimitCORE=infinity
# Comment TasksMax if your systemd version does not support it.
# Only systemd 226 and above support this option.
TasksMax=infinity
# set delegate yes so that systemd does not reset the cgroups of docker containers
Delegate=yes
# kill only the docker process, not all processes in the cgroup
KillMode=process
OOMScoreAdjust=-500
[Install]
WantedBy=multi-user.target发布于 2021-05-17 11:06:24
首先,检查/var/run中的符号链接是否已经就绪,并指向/run (在您的情况下,这似乎是可以的)。
接下来,尝试通过创建下拉配置来更改"ExecStart“语句:
sudo mkdir -p /etc/systemd/system/docker.service.d
sudo nano /etc/systemd/system/docker.service.d/options.conf现在将以下内容添加到文件/etc/systemd/system/docker.service.d/options.conf中:
[Service]
ExecStart=
ExecStart=/usr/bin/dockerd -H unix:// --containerd=/run/containerd/containerd.sock现在重新加载systemd配置并重新加载docker守护进程:
sudo systemctl daemon-reload
sudo systemctl restart docker如果还希望守护进程在远程端口上侦听,请将-H tcp://0.0.0.0:2375添加到/etc/systemd/system/docker.service.d/options.conf中的"ExecStart“条目:
[Service]
ExecStart=
ExecStart=/usr/bin/dockerd -H unix:// -H tcp://0.0.0.0:2375 --containerd=/run/containerd/containerd.sock但是,在您的例子中,更改为-H unix://似乎是很有效的。
发布于 2022-09-02 21:25:49
尝试重新启动docker.socket服务或重新启动系统,如果这是一个选项:
sudo systemctl restart docker.sockethttps://askubuntu.com/questions/1338819
复制相似问题