Skip to content

Installing docker-ce through systemd "fails" due to docker.service not finding socket on first try #989

@Nacknime

Description

@Nacknime
  • This is a bug report
  • This is a feature request
  • I searched existing issues before opening this one

get-docker.sh is invoked in a systemd service.

Expected behavior

The systemd service successfully installs Docker using the get-docker.sh script and apt-get.

Actual behavior

Once get-docker.sh gets to apt-get installing docker-ce, it fails once it gets to the docker-ce postinstall step.

journalctl -xu docker-install.service:

Apr 27 16:27:09 home init.sh[293]: Setting up docker-ce (5:19.03.8~3-0~raspbian-buster) ...
Apr 27 16:27:10 home init.sh[293]: Created symlink /etc/systemd/system/multi-user.target.wants/docker.service → /lib/systemd/system/docker.service.
Apr 27 16:27:11 home init.sh[293]: Created symlink /etc/systemd/system/sockets.target.wants/docker.socket → /lib/systemd/system/docker.socket.
Apr 27 16:27:13 home init.sh[293]: Job for docker.service failed because the control process exited with error code.
Apr 27 16:27:13 home init.sh[293]: dpkg: error processing package docker-ce (--configure):
Apr 27 16:27:13 home init.sh[293]:  installed docker-ce package post-installation script subprocess returned error exit status 1

This causes the whole get-docker.sh script to be considered failed and the service failed as well.

More information about why docker.service fails can be found in journalctl -xu docker.service:

Apr 27 16:27:13 home systemd[1]: Starting Docker Application Container Engine...
Apr 27 16:27:13 home dockerd[1084]: time="2020-04-27T16:27:13.852785635+01:00" level=info msg="Starting up"
Apr 27 16:27:13 home dockerd[1084]: failed to load listeners: no sockets found via socket activation: make sure the service was started by systemd
Apr 27 16:27:13 home systemd[1]: docker.service: Main process exited, code=exited, status=1/FAILURE
Apr 27 16:27:13 home systemd[1]: docker.service: Failed with result 'exit-code'.
Apr 27 16:27:13 home systemd[1]: Failed to start Docker Application Container Engine.

When the docker.service is automatically retried 2 seconds later, it starts with no problems.

Afterwards, Docker seems to be installed properly, even though apt-get/dpkg report a failure. dpkg --status docker-ce:

Package: docker-ce
Status: install ok half-configured

Steps to reproduce the behavior

  • Download the get-docker.sh script.
  • Create a systemd service (e.g. docker-install.service) that invokes get-docker.sh and enable it.
  • Reboot

Simply invoking the installation manually from shell does not lead to the same issue.

Output of docker version:

Client: Docker Engine - Community
 Version:           19.03.8
 API version:       1.40
 Go version:        go1.12.17
 Git commit:        afacb8b
 Built:             Wed Mar 11 01:35:24 2020
 OS/Arch:           linux/arm
 Experimental:      false

Server: Docker Engine - Community
 Engine:
  Version:          19.03.8
  API version:      1.40 (minimum version 1.12)
  Go version:       go1.12.17
  Git commit:       afacb8b
  Built:            Wed Mar 11 01:29:22 2020
  OS/Arch:          linux/arm
  Experimental:     false
 containerd:
  Version:          1.2.13
  GitCommit:        7ad184331fa3e55e52b890ea95e65ba581ae3429
 runc:
  Version:          1.0.0-rc10
  GitCommit:        dc9208a3303feef5b3839f4323d9beb36df0a9dd
 docker-init:
  Version:          0.18.0
  GitCommit:        fec3683

Output of docker info:

Client:
 Debug Mode: false

Server:
 Containers: 3
  Running: 0
  Paused: 0
  Stopped: 3
 Images: 5
 Server Version: 19.03.8
 Storage Driver: overlay2
  Backing Filesystem: <unknown>
  Supports d_type: true
  Native Overlay Diff: true
 Logging Driver: json-file
 Cgroup Driver: cgroupfs
 Plugins:
  Volume: local
  Network: bridge host ipvlan macvlan null overlay
  Log: awslogs fluentd gcplogs gelf journald json-file local logentries splunk syslog
 Swarm: inactive
 Runtimes: runc
 Default Runtime: runc
 Init Binary: docker-init
 containerd version: 7ad184331fa3e55e52b890ea95e65ba581ae3429
 runc version: dc9208a3303feef5b3839f4323d9beb36df0a9dd
 init version: fec3683
 Security Options:
  seccomp
   Profile: default
 Kernel Version: 4.19.97-v7+
 Operating System: Raspbian GNU/Linux 10 (buster)
 OSType: linux
 Architecture: armv7l
 CPUs: 4
 Total Memory: 926.1MiB
 Name: home
 ID: JXJO:MVBV:XODO:WSKR:UCMS:T6P7:5GY5:AJEH:FSCD:HF56:EFNE:OAXZ
 Docker Root Dir: /var/lib/docker
 Debug Mode: false
 Registry: https://index.docker.io/v1/
 Labels:
 Experimental: false
 Insecure Registries:
  127.0.0.0/8
 Live Restore Enabled: false

WARNING: No swap limit support
WARNING: No cpu cfs quota support
WARNING: No cpu cfs period support

Additional environment details (AWS, VirtualBox, physical, etc.)

Raspberry Pi 4, Raspbian Buster, uname -a:

Linux home 4.19.97-v7+ #1294 SMP Thu Jan 30 13:15:58 GMT 2020 armv7l GNU/Linux

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions