systemd "docker.socket" missing on todays update
- [x] This is a bug report
- [ ] This is a feature request
- [ ] I searched existing issues before opening this one
Expected behavior
Upgrade to 18.09.0~3-0~debian-stretch works painlessley.
Actual behavior
Upgrade to 18.09.0~3-0~debian-stretch removes the file /lib/systemd/system/docker.socket and does not restart after the upgrade.
Steps to reproduce the behavior
Run apt-get dist-upgrade on a Debian stretch system with an older docker-ce package installed.
I confirm.
Downgrading back manually by downloading 18.06.1~ce~3-0~debian is a temporary workaround. But not very useful for devOps :-/
apt remove --purge containerd.io docker-ce docker-ce-cli
wget https://download.docker.com/linux/debian/dists/stretch/pool/stable/amd64/docker-ce_18.06.1~ce~3-0~debian_amd64.deb
dpkg -i docker-ce_18.06.1~ce~3-0~debian_amd64.deb
I confirm also in ubuntu.
apt purge --auto-remove docker-ce
apt install docker-ce=18.06.1~ce~3-0~ubuntu
does the trick. however, i digged into this and :
xxx systemd[1]: Starting containerd container runtime...
xxx systemd[1]: Starting Docker Application Container Engine...
xxx modprobe[13353]: modprobe: ERROR: ../libkmod/libkmod.c:586 kmod_search_moddep() could not open moddep file '/lib/modules/4.4.110-x86_64-jb1/modules.dep.bin'
xxx modprobe[13353]: modprobe: FATAL: Module overlay not found in directory /lib/modules/4.4.110-x86_64-jb1
xxx systemd[1]: containerd.service: Control process exited, code=exited status=1
xxx systemd[1]: containerd.service: Failed with result 'exit-code'.
xxx systemd[1]: Failed to start containerd container runtime.
xxx systemd[1]: Dependency failed for Docker Application Container Engine.
xxx systemd[1]: docker.service: Job docker.service/start failed with result 'dependency'.
xxx systemd[1]: Stopped Docker Application Container Engine.
Also reported in https://github.com/moby/moby/issues/38119
Same problem for me:
$ docker version
Client: Version: 18.09.0 API version: 1.39 Go version: go1.10.4 Git commit: 4d60db4 Built: Wed Nov 7 00:49:01 2018 OS/Arch: linux/amd64 Experimental: false Cannot connect to the Docker daemon at unix:///var/run/docker.sock. Is the docker daemon running?
$ systemctl status docker.service
● docker.service - Docker Application Container Engine
Loaded: loaded (/lib/systemd/system/docker.service; enabled; vendor preset: enabled)
Drop-In: /etc/systemd/system/docker.service.d
└─override.conf
Active: failed (Result: exit-code) since Thu 2018-11-08 21:13:33 CET; 22min ago
Docs: https://docs.docker.com
Process: 2801 ExecStart=/usr/bin/dockerd -H fd:// --live-restore (code=exited, status=1/FAILURE)
Main PID: 2801 (code=exited, status=1/FAILURE)
$ journalctl -x
-- Unit docker.service has begun starting up. Nov 08 21:40:31 ns538586.ip-158-69-247.net dockerd[4534]: Failed to load listeners: no sockets found via socket activation: make sure the service was started by systemd Nov 08 21:40:31 ns538586.ip-158-69-247.net systemd[1]: docker.service: Main process exited, code=exited, status=1/FAILURE Nov 08 21:40:31 ns538586.ip-158-69-247.net systemd[1]: docker.service: Failed with result 'exit-code'. Nov 08 21:40:31 ns538586.ip-158-69-247.net systemd[1]: Failed to start Docker Application Container Engine. -- Subject: Unit docker.service has failed -- Defined-By: systemd
Downgrade to docker-ce=18.06.1~ce~3-0~ubuntu works for me too
on my rasbian i could not start docker after the update.
journalctl -fu docker -- Logs begin at Thu 2018-11-08 21:09:34 CET. -- Nov 08 21:12:18 Pi3B-01 systemd[1]: docker.service: Main process exited, code=exited, status=1/FAILURE Nov 08 21:12:18 Pi3B-01 systemd[1]: Failed to start Docker Application Container Engine. Nov 08 21:12:18 Pi3B-01 systemd[1]: docker.service: Unit entered failed state. Nov 08 21:12:18 Pi3B-01 systemd[1]: docker.service: Failed with result 'exit-code'. Nov 08 21:12:21 Pi3B-01 systemd[1]: docker.service: Service hold-off time over, scheduling restart. Nov 08 21:12:21 Pi3B-01 systemd[1]: Stopped Docker Application Container Engine. Nov 08 21:12:21 Pi3B-01 systemd[1]: docker.service: Start request repeated too quickly. Nov 08 21:12:21 Pi3B-01 systemd[1]: Failed to start Docker Application Container Engine. Nov 08 21:12:21 Pi3B-01 systemd[1]: docker.service: Unit entered failed state. Nov 08 21:12:21 Pi3B-01 systemd[1]: docker.service: Failed with result 'exit-code'.
i found out that i had a new file in /systemd/system/docker.service.d/override.conf (i backup my /etc folder, so i can see that this file did not exist yesterday)
with this content:
# /etc/systemd/system/docker.service.d/override.conf
[Service]
ExecStart=
ExecStart=/usr/bin/dockerd -H fd:// -H tcp://0.0.0.0:2375
sudo systemctl daemon-reload
sudo systemctl restart docker.service
so wtf i dont know where this file came from, but this is a loop.
but even if i remove the last 2 lines i cannot start docker.
i can start again after removing -H fd://, but this kills docker ps etc.
Nov 08 22:04:44 Pi3B-01 sudo[12431]: pi : TTY=pts/1 ; PWD=/home/pi ; USER=root ; COMMAND=/bin/systemctl start docker
Nov 08 22:04:44 Pi3B-01 sudo[12431]: pam_unix(sudo:session): session opened for user root by pi(uid=0)
Nov 08 22:04:44 Pi3B-01 systemd[1]: docker.service: Start request repeated too quickly.
Nov 08 22:04:44 Pi3B-01 systemd[1]: Failed to start Docker Application Container Engine.
-- Subject: Unit docker.service has failed
-- Defined-By: systemd
-- Support: https://www.debian.org/support
--
-- Unit docker.service has failed.
--
-- The result is failed.
Nov 08 22:04:44 Pi3B-01 systemd[1]: docker.service: Failed with result 'exit-code'.
can also confirm that /lib/systemd/system/docker.socket is missing.
somewhere in the logs i also read that unix did not get detected, instead it was sth with rtcp or similar, cannot find and remember it :S
https://github.com/moby/moby/issues/22847#issuecomment-437146373 https://github.com/docker/for-linux/issues/162 https://github.com/moby/moby/issues/22847#issuecomment-437146373
Maybe include systemd integration tests before releasing a new version?
Maybe include systemd integration tests before releasing a new version?
There's tests for this, but unfortunately, the problem with the daemon failing to start won't manifest it self on a fresh install, and only will only be an issue if;
- the dockerd systemd unit has been modified by the user. If the unit file is modified, it won't be updated with the latest version that ships with the rpm/deb package (rpm/deb will detect it's modified and will leave it untouched); never modify the systemd unit file itself, but use a "drop-in" file (override file) to customise the unit file. However;
- if you used a systemd drop-in file, and that file has an
ExecStartwithdockerd -H fd://, the service will fail to start, as it won't be able to connect to a socket created by systemd.
If you're in situation 1.;
The unmodified systemd unit file that ships with Docker 18.09.0 can be found here; https://github.com/docker/docker-ce/blob/v18.09.0/components/packaging/systemd/docker.service
If you're in situation 2.:
If you need socket activation; restore the docker.socket unit-file from the 18.06 release; https://github.com/docker/docker-ce/blob/18.06/components/packaging/deb/systemd/docker.socket
If you don't need socket activation; either:
- remove the
-H fd://from theExecStart(if you don't have other-Hoptions set) - change to
-H unix://instead.
Work is in progress to add back socket activation (see https://github.com/docker/docker-ce-packaging/pull/257), which will be either in an upcoming patch release, or in a package update.
There's tests for this, but unfortunately, the problem with the daemon failing to start won't manifest it self on a fresh install, and only will only be an issue if;
i don't have any custom config files and it still fails. maybe also add this test case to your testsuite? install previous version and upgrade.
Trying to reproduce, but it seems to work for me (Ubuntu 16.04 in this case);
Version installed before upgrading;
docker version
Client:
Version: 18.06.1-ce
API version: 1.38
Go version: go1.10.3
Git commit: e68fc7a
Built: Tue Aug 21 17:24:56 2018
OS/Arch: linux/amd64
Experimental: false
Server:
Engine:
Version: 18.06.1-ce
API version: 1.38 (minimum version 1.12)
Go version: go1.10.3
Git commit: e68fc7a
Built: Tue Aug 21 17:23:21 2018
OS/Arch: linux/amd64
Experimental: false
Check the service's unit-file for modifications (and/or show overrides/drop-ins);
systemctl cat docker.service
# /lib/systemd/system/docker.service
[Unit]
Description=Docker Application Container Engine
Documentation=https://docs.docker.com
After=network-online.target docker.socket firewalld.service
Wants=network-online.target
Requires=docker.socket
[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://
ExecReload=/bin/kill -s HUP $MAINPID
LimitNOFILE=1048576
# Having non-zero Limit*s causes performance problems due to accounting overhead
# in the kernel. We recommend using cgroups to do container-local accounting.
LimitNPROC=infinity
LimitCORE=infinity
# Uncomment TasksMax if your systemd version supports it.
# Only systemd 226 and above support this version.
TasksMax=infinity
TimeoutStartSec=0
# 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
# restart the docker process if it exits prematurely
Restart=on-failure
StartLimitBurst=3
StartLimitInterval=60s
[Install]
WantedBy=multi-user.target
Update docker;
apt-get update && apt-get install docker-ce
Hit:2 http://security.ubuntu.com/ubuntu xenial-security InRelease
Hit:1 http://lon1.mirrors.digitalocean.com/ubuntu xenial InRelease
Hit:3 http://lon1.mirrors.digitalocean.com/ubuntu xenial-updates InRelease
Hit:4 https://repos.sonar.digitalocean.com/apt main InRelease
Hit:5 https://download.docker.com/linux/ubuntu xenial InRelease
Hit:6 http://lon1.mirrors.digitalocean.com/ubuntu xenial-backports InRelease
Reading package lists... Done
Reading package lists... Done
Building dependency tree
Reading state information... Done
The following packages were automatically installed and are no longer required:
linux-headers-4.4.0-134 linux-headers-4.4.0-134-generic linux-image-4.4.0-134-generic
Use 'apt autoremove' to remove them.
The following additional packages will be installed:
containerd.io docker-ce-cli
The following NEW packages will be installed:
containerd.io docker-ce-cli
The following packages will be upgraded:
docker-ce
1 upgraded, 2 newly installed, 0 to remove and 26 not upgraded.
Need to get 50.2 MB of archives.
After this operation, 44.4 MB of additional disk space will be used.
Do you want to continue? [Y/n] Y
Get:1 https://download.docker.com/linux/ubuntu xenial/stable amd64 containerd.io amd64 1.2.0-1 [19.9 MB]
Get:2 https://download.docker.com/linux/ubuntu xenial/stable amd64 docker-ce amd64 5:18.09.0~3-0~ubuntu-xenial [17.4 MB]
Get:3 https://download.docker.com/linux/ubuntu xenial/stable amd64 docker-ce-cli amd64 5:18.09.0~3-0~ubuntu-xenial [13.0 MB]
Fetched 50.2 MB in 1s (32.8 MB/s)
perl: warning: Setting locale failed.
perl: warning: Please check that your locale settings:
LANGUAGE = (unset),
LC_ALL = (unset),
LC_CTYPE = "UTF-8",
LANG = "en_US.UTF-8"
are supported and installed on your system.
perl: warning: Falling back to a fallback locale ("en_US.UTF-8").
locale: Cannot set LC_CTYPE to default locale: No such file or directory
locale: Cannot set LC_ALL to default locale: No such file or directory
Selecting previously unselected package containerd.io.
(Reading database ... 138271 files and directories currently installed.)
Preparing to unpack .../containerd.io_1.2.0-1_amd64.deb ...
Unpacking containerd.io (1.2.0-1) ...
Preparing to unpack .../docker-ce_5%3a18.09.0~3-0~ubuntu-xenial_amd64.deb ...
Unpacking docker-ce (5:18.09.0~3-0~ubuntu-xenial) over (18.06.1~ce~3-0~ubuntu) ...
Selecting previously unselected package docker-ce-cli.
Preparing to unpack .../docker-ce-cli_5%3a18.09.0~3-0~ubuntu-xenial_amd64.deb ...
Unpacking docker-ce-cli (5:18.09.0~3-0~ubuntu-xenial) ...
Processing triggers for man-db (2.7.5-1) ...
Setting up containerd.io (1.2.0-1) ...
Setting up docker-ce-cli (5:18.09.0~3-0~ubuntu-xenial) ...
Setting up docker-ce (5:18.09.0~3-0~ubuntu-xenial) ...
update-alternatives: using /usr/bin/dockerd-ce to provide /usr/bin/dockerd (dockerd) in auto mode
Verify that it's upgraded, and started;
docker version
Client:
Version: 18.09.0
API version: 1.39
Go version: go1.10.4
Git commit: 4d60db4
Built: Wed Nov 7 00:48:57 2018
OS/Arch: linux/amd64
Experimental: false
Server: Docker Engine - Community
Engine:
Version: 18.09.0
API version: 1.39 (minimum version 1.12)
Go version: go1.10.4
Git commit: 4d60db4
Built: Wed Nov 7 00:16:44 2018
OS/Arch: linux/amd64
Experimental: false
/lib/systemd/system/docker.service looks exact the same like from your link ( https://github.com/docker/docker-ce/blob/v18.09.0/components/packaging/systemd/docker.service )
-H unix:// still shows same error as above
placed docker.socket in /lib/systemd/system, still same error
now i saw that /var/run/docker.sock is a folder?!
drwx------ 8 root root 160 Nov 9 17:22 docker
drwxr-xr-x 2 root root 40 Nov 8 22:50 docker.sock
@reloxx13: Please run
systemctl deamon-reload
on a debian stretch system after you placed the docker.socket file int the folder /lib/systemd/system. After that you can run
systemctl restart docker.service
nope, wont start :/
sudo /usr/bin/dockerd
Failed to load listeners: can't create unix socket /var/run/docker.sock: is a directory
after some googling (https://github.com/moby/moby/issues/30348) i moved the folder away and now docker starts again 👍
My workaround for Rasbian;
sudo curl https://raw.githubusercontent.com/docker/docker-ce-packaging/master/systemd/docker.socket -o /lib/systemd/system/docker.socket
check if file exists, only if exists check the content, has to be this: ( sudo systemctl edit docker.service )
# /etc/systemd/system/docker.service.d/override.conf
[Service]
ExecStart=
ExecStart=/usr/bin/dockerd -H unix:// -H tcp://127.0.0.1:2375
sudo systemctl daemon-reload
sudo systemctl restart docker.service
if docker started, remove rm -rf /var/run/docker.sock.bk
Trying to reproduce, but it seems to work for me (Ubuntu 16.04 in this case);
Version installed before upgrading;
docker version Client: Version: 18.06.1-ce API version: 1.38 Go version: go1.10.3 Git commit: e68fc7a Built: Tue Aug 21 17:24:56 2018 OS/Arch: linux/amd64 Experimental: false Server: Engine: Version: 18.06.1-ce API version: 1.38 (minimum version 1.12) Go version: go1.10.3 Git commit: e68fc7a Built: Tue Aug 21 17:23:21 2018 OS/Arch: linux/amd64 Experimental: falseCheck the service's unit-file for modifications (and/or show overrides/drop-ins);
systemctl cat docker.service # /lib/systemd/system/docker.service [Unit] Description=Docker Application Container Engine Documentation=https://docs.docker.com After=network-online.target docker.socket firewalld.service Wants=network-online.target Requires=docker.socket [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:// ExecReload=/bin/kill -s HUP $MAINPID LimitNOFILE=1048576 # Having non-zero Limit*s causes performance problems due to accounting overhead # in the kernel. We recommend using cgroups to do container-local accounting. LimitNPROC=infinity LimitCORE=infinity # Uncomment TasksMax if your systemd version supports it. # Only systemd 226 and above support this version. TasksMax=infinity TimeoutStartSec=0 # 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 # restart the docker process if it exits prematurely Restart=on-failure StartLimitBurst=3 StartLimitInterval=60s [Install] WantedBy=multi-user.targetUpdate docker;
apt-get update && apt-get install docker-ce Hit:2 http://security.ubuntu.com/ubuntu xenial-security InRelease Hit:1 http://lon1.mirrors.digitalocean.com/ubuntu xenial InRelease Hit:3 http://lon1.mirrors.digitalocean.com/ubuntu xenial-updates InRelease Hit:4 https://repos.sonar.digitalocean.com/apt main InRelease Hit:5 https://download.docker.com/linux/ubuntu xenial InRelease Hit:6 http://lon1.mirrors.digitalocean.com/ubuntu xenial-backports InRelease Reading package lists... Done Reading package lists... Done Building dependency tree Reading state information... Done The following packages were automatically installed and are no longer required: linux-headers-4.4.0-134 linux-headers-4.4.0-134-generic linux-image-4.4.0-134-generic Use 'apt autoremove' to remove them. The following additional packages will be installed: containerd.io docker-ce-cli The following NEW packages will be installed: containerd.io docker-ce-cli The following packages will be upgraded: docker-ce 1 upgraded, 2 newly installed, 0 to remove and 26 not upgraded. Need to get 50.2 MB of archives. After this operation, 44.4 MB of additional disk space will be used. Do you want to continue? [Y/n] Y Get:1 https://download.docker.com/linux/ubuntu xenial/stable amd64 containerd.io amd64 1.2.0-1 [19.9 MB] Get:2 https://download.docker.com/linux/ubuntu xenial/stable amd64 docker-ce amd64 5:18.09.0~3-0~ubuntu-xenial [17.4 MB] Get:3 https://download.docker.com/linux/ubuntu xenial/stable amd64 docker-ce-cli amd64 5:18.09.0~3-0~ubuntu-xenial [13.0 MB] Fetched 50.2 MB in 1s (32.8 MB/s) perl: warning: Setting locale failed. perl: warning: Please check that your locale settings: LANGUAGE = (unset), LC_ALL = (unset), LC_CTYPE = "UTF-8", LANG = "en_US.UTF-8" are supported and installed on your system. perl: warning: Falling back to a fallback locale ("en_US.UTF-8"). locale: Cannot set LC_CTYPE to default locale: No such file or directory locale: Cannot set LC_ALL to default locale: No such file or directory Selecting previously unselected package containerd.io. (Reading database ... 138271 files and directories currently installed.) Preparing to unpack .../containerd.io_1.2.0-1_amd64.deb ... Unpacking containerd.io (1.2.0-1) ... Preparing to unpack .../docker-ce_5%3a18.09.0~3-0~ubuntu-xenial_amd64.deb ... Unpacking docker-ce (5:18.09.0~3-0~ubuntu-xenial) over (18.06.1~ce~3-0~ubuntu) ... Selecting previously unselected package docker-ce-cli. Preparing to unpack .../docker-ce-cli_5%3a18.09.0~3-0~ubuntu-xenial_amd64.deb ... Unpacking docker-ce-cli (5:18.09.0~3-0~ubuntu-xenial) ... Processing triggers for man-db (2.7.5-1) ... Setting up containerd.io (1.2.0-1) ... Setting up docker-ce-cli (5:18.09.0~3-0~ubuntu-xenial) ... Setting up docker-ce (5:18.09.0~3-0~ubuntu-xenial) ... update-alternatives: using /usr/bin/dockerd-ce to provide /usr/bin/dockerd (dockerd) in auto modeVerify that it's upgraded, and started;
docker version Client: Version: 18.09.0 API version: 1.39 Go version: go1.10.4 Git commit: 4d60db4 Built: Wed Nov 7 00:48:57 2018 OS/Arch: linux/amd64 Experimental: false Server: Docker Engine - Community Engine: Version: 18.09.0 API version: 1.39 (minimum version 1.12) Go version: go1.10.4 Git commit: 4d60db4 Built: Wed Nov 7 00:16:44 2018 OS/Arch: linux/amd64 Experimental: false
does docker-compose change anything ?
can't create unix socket /var/run/docker.sock: is a directory
I suspect you've (at some point) had a container that bind-mounted the docker-socket. In case of a race condition (where the docker socket is not yet up, but the container is), that will result in docker creating a directory at that location if you're using the -v flag.
To prevent that from happening; use the --mount flag instead. That flag won't create the missing path, and will instead refuse to start the container;
So instead of
-v /var/run/docker.sock:/var/run/docker.sock
Use this;
--mount type=bind,src=/var/run/docker.sock,dst=/var/run/docker.sock
does docker-compose change anything ?
no, it shouldn't. docker-compose is a whole separate package
@thaJeztah yep, portainer is using docker.sock, but it shows it uses bind and not volume

think due the failed startups and missing unix:// it just failed at some point. never had that directory msg before.
If you're specifying a host path, it's a bind-mount, not a volume. It's confusing, because at the time the -v/--volume flag was added, there were no managed volumes yet, so they were considered to be the same
But it also depends which part of the API is used for those settings (the "mount" or "volume" API) 😅
Downgrading as mentioned by @Val fixed the issue for me - thank you.
apt remove --purge containerd.io docker-ce docker-ce-cli wget https://download.docker.com/linux/debian/dists/stretch/pool/stable/amd64/docker-ce_18.06.1~ce~3-0~debian_amd64.deb dpkg -i docker-ce_18.06.1~ce~3-0~debian_amd64.deb
Hello,
I'm using Docker version 18.09.0, build 4d60db4
My systemd unit file is same as https://raw.githubusercontent.com/docker/docker-ce/v18.09.0/components/packaging/systemd/docker.service
I can't start docker service (after upgrade from 18.06 version), but mine fails on containerd service dependency.
containerd.service - containerd container runtime
Loaded: loaded (/usr/lib/systemd/system/containerd.service; disabled; vendor preset: disabled)
Active: failed (Result: exit-code) since Mon 2018-11-19 17:29:50 CET; 4s ago
Docs: https://containerd.io
Process: 1905 ExecStartPre=/sbin/modprobe overlay (code=exited, status=1/FAILURE)
Edit: And I've found same open issue #475