How do I install Docker on my Ubuntu 18.04 Linode?

When I follow the directions at

https://www.linode.com/docs/applications/containers/install-docker-ce-ubuntu-1804/

I get the following results and an error when Docker is started (any help will be greatly appreciated):

ddowdell@cirrus:~$ sudo sudo apt remove docker docker-engine docker.io
[sudo] password for ddowdell:
Reading package lists… Done
Building dependency tree
Reading state information… Done
Package 'docker-engine' is not installed, so not removed
Package 'docker' is not installed, so not removed
Package 'docker.io' is not installed, so not removed
The following packages were automatically installed and are no longer required:
aufs-tools cgroupfs-mount containerd.io docker-ce-cli libltdl7 pigz
Use 'sudo apt autoremove' to remove them.
0 upgraded, 0 newly installed, 0 to remove and 0 not upgraded.
ddowdell@cirrus:~$ sudo apt autoremove
Reading package lists… Done
Building dependency tree
Reading state information… Done
The following packages will be REMOVED:
aufs-tools cgroupfs-mount containerd.io docker-ce-cli libltdl7 pigz
0 upgraded, 0 newly installed, 6 to remove and 0 not upgraded.
After this operation, 282 MB disk space will be freed.
Do you want to continue? [Y/n] y
(Reading database … 139309 files and directories currently installed.)
Removing aufs-tools (1:4.9+20170918-1ubuntu1) …
Removing cgroupfs-mount (1.4) …
Removing containerd.io (1.2.6-3) …
Removing docker-ce-cli (5:19.03.2~3-0~ubuntu-bionic) …
Removing libltdl7:amd64 (2.4.6-2) …
Removing pigz (2.4-1) …
Processing triggers for man-db (2.8.3-2ubuntu0.1) …
Processing triggers for libc-bin (2.27-3ubuntu1) …
ddowdell@cirrus:~$ sudo apt install apt-transport-https ca-certificates curl software-properties-common
Reading package lists… Done
Building dependency tree
Reading state information… Done
ca-certificates is already the newest version (20180409).
curl is already the newest version (7.58.0-2ubuntu3.8).
software-properties-common is already the newest version (0.96.24.32.11).
apt-transport-https is already the newest version (1.6.12).
0 upgraded, 0 newly installed, 0 to remove and 0 not upgraded.
ddowdell@cirrus:~$ curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo apt-key add -
OK
ddowdell@cirrus:~$ sudo apt-key fingerprint 0EBFCD88
pub rsa4096 2017-02-22 [SCEA]
9DC8 5822 9FC7 DD38 854A E2D8 8D81 803C 0EBF CD88
uid [ unknown] Docker Release (CE deb) docker@docker.com
sub rsa4096 2017-02-22 [S]

ddowdell@cirrus:~$ sudo add-apt-repository "deb [arch=amd64] https://download.docker.com/linux/ubuntu $(lsb_release -cs) stable"
Hit:1 http://mirrors.linode.com/ubuntu bionic InRelease
Get:2 http://mirrors.linode.com/ubuntu bionic-updates InRelease [88.7 kB]
Hit:3 http://mirrors.linode.com/ubuntu bionic-backports InRelease
Hit:4 https://download.docker.com/linux/ubuntu bionic InRelease
Hit:5 http://security.ubuntu.com/ubuntu bionic-security InRelease
Fetched 88.7 kB in 1s (129 kB/s)
Reading package lists… Done
ddowdell@cirrus:~$ sudo apt update
Hit:1 http://mirrors.linode.com/ubuntu bionic InRelease
Get:2 http://mirrors.linode.com/ubuntu bionic-updates InRelease [88.7 kB]
Hit:3 http://mirrors.linode.com/ubuntu bionic-backports InRelease
Hit:4 https://download.docker.com/linux/ubuntu bionic InRelease
Hit:5 http://security.ubuntu.com/ubuntu bionic-security InRelease
Fetched 88.7 kB in 1s (163 kB/s)
Reading package lists… Done
Building dependency tree
Reading state information… Done
All packages are up to date.
ddowdell@cirrus:~$ sudo apt install docker-ce
Reading package lists… Done
Building dependency tree
Reading state information… Done
The following additional packages will be installed:
aufs-tools cgroupfs-mount containerd.io docker-ce-cli libltdl7 pigz
The following NEW packages will be installed:
aufs-tools cgroupfs-mount containerd.io docker-ce docker-ce-cli libltdl7 pigz
0 upgraded, 7 newly installed, 0 to remove and 0 not upgraded.
Need to get 0 B/88.0 MB of archives.
After this operation, 390 MB of additional disk space will be used.
Do you want to continue? [Y/n] y
Selecting previously unselected package pigz.
(Reading database … 139016 files and directories currently installed.)
Preparing to unpack …/0-pigz_2.4-1_amd64.deb …
Unpacking pigz (2.4-1) …
Selecting previously unselected package aufs-tools.
Preparing to unpack …/1-aufs-tools_1%3a4.9+20170918-1ubuntu1_amd64.deb …
Unpacking aufs-tools (1:4.9+20170918-1ubuntu1) …
Selecting previously unselected package cgroupfs-mount.
Preparing to unpack …/2-cgroupfs-mount_1.4_all.deb …
Unpacking cgroupfs-mount (1.4) …
Selecting previously unselected package containerd.io.
Preparing to unpack …/3-containerd.io_1.2.6-3_amd64.deb …
Unpacking containerd.io (1.2.6-3) …
Selecting previously unselected package docker-ce-cli.
Preparing to unpack …/4-docker-ce-cli_5%3a19.03.2~3-0~ubuntu-bionic_amd64.deb …
Unpacking docker-ce-cli (5:19.03.2~3-0~ubuntu-bionic) …
Selecting previously unselected package docker-ce.
Preparing to unpack …/5-docker-ce_5%3a19.03.2~3-0~ubuntu-bionic_amd64.deb …
Unpacking docker-ce (5:19.03.2~3-0~ubuntu-bionic) …
Selecting previously unselected package libltdl7:amd64.
Preparing to unpack …/6-libltdl7_2.4.6-2_amd64.deb …
Unpacking libltdl7:amd64 (2.4.6-2) …
Setting up aufs-tools (1:4.9+20170918-1ubuntu1) …
Setting up containerd.io (1.2.6-3) …
Setting up cgroupfs-mount (1.4) …
Setting up libltdl7:amd64 (2.4.6-2) …
Setting up docker-ce-cli (5:19.03.2~3-0~ubuntu-bionic) …
Setting up pigz (2.4-1) …
Setting up docker-ce (5:19.03.2~3-0~ubuntu-bionic) …
Created symlink /etc/systemd/system/multi-user.target.wants/docker.service → /lib/systemd/system/docker.service.
Created symlink /etc/systemd/system/sockets.target.wants/docker.socket → /lib/systemd/system/docker.socket.
Job for docker.service failed because the control process exited with error code.
See "systemctl status docker.service" and "journalctl -xe" for details.
invoke-rc.d: initscript docker, action "start" failed.
● docker.service - Docker Application Container Engine
Loaded: loaded (/lib/systemd/system/docker.service; enabled; vendor preset: enabled)
Active: activating (auto-restart) (Result: exit-code) since Sun 2019-09-29 16:49:03 UTC; 13ms ago
Docs: https://docs.docker.com
Process: 8865 ExecStart=/usr/bin/dockerd -H fd:// --containerd=/run/containerd/containerd.sock (code=exited, status=1/FAILURE)
Main PID: 8865 (code=exited, status=1/FAILURE)

Sep 29 16:49:03 cirrus systemd[1]: docker.service: Main process exited, code=exited, status=1/FAILURE
Sep 29 16:49:03 cirrus systemd[1]: docker.service: Failed with result 'exit-code'.
Sep 29 16:49:03 cirrus systemd[1]: Failed to start Docker Application Container Engine.
dpkg: error processing package docker-ce (--configure):
installed docker-ce package post-installation script subprocess returned error exit status 1
Processing triggers for libc-bin (2.27-3ubuntu1) …
Processing triggers for systemd (237-3ubuntu10.29) …
Processing triggers for man-db (2.8.3-2ubuntu0.1) …
Processing triggers for ureadahead (0.100.0-21) …
Errors were encountered while processing:
docker-ce
E: Sub-process /usr/bin/dpkg returned an error code (1)

7 Replies

Thanks for providing such complete error messages! It really makes getting to the bottom of this a lot easier. The real roadblock you ran into was E: Sub-process /usr/bin/dpkg returned an error code (1)

This is actually a fairly common error code, and it indicates a broken package. There are a couple of ways to fix it, and I would recommend running sudo apt update after you try one of these steps before you try to reinstall Docker

1) The first method you can try is to reconfigure the package database. Sometimes the database gets corrupted while installing a package. Reconfiguring can help fix that up.

sudo dpkg --configure -a

2) If a package installation was interrupted previously it might leave some bits and pieces laying around. You can try a fix install.

sudo apt-get install -f

3) On the same note as the above, sometimes there are stray files left over that can cause issues. You can try removing files associated with Docker from /var/lib/dpkg/info. I would recommend saving this for a last resort. To find those files you can run something like this.

ls -l /var/lib/dpkg/info | grep -i docker-ce
(some files will come up)
sudo mv /var/lib/dpkg/info/docker-ce.* /tmp

Which will move those files out of the dpkg directory into temp where they will go away as soon as you reboot. Please note, that you should be careful when globbing for those files. Base it on what the grep actually returns and please don't just copy and paste it in. When in doubt, mv the files one at a time.

Tbaka, thank you very much for your detailed response. I had already tried steps 1 and 2 without success. I'll try steps 1 thru 3 and let you know what happens.

Originally on the Linode, I had used my normal Docker installation method:

sudo wget -qO- https://get.docker.com | sh

with the same error result. It had worked on my bare metal Ubuntu 18.04 instances, but may have left something in a non-standard state.

Thanks, again.

Tbaka, I executed all three of the steps you indicated with essentially the same result.

ddowdell@cirrus:~$ sudo systemctl restart docker
[sudo] password for ddowdell:
Job for docker.service failed because the control process exited with error code.
See "systemctl status docker.service" and "journalctl -xe" for details.
ddowdell@cirrus:~$ sudo journalctl -xe
-- Defined-By: systemd

-- Support: http://www.ubuntu.com/support

-- Unit docker.socket has begun starting up.
Sep 30 15:35:50 cirrus systemd[1]: Listening on Docker Socket for the API.
-- Subject: Unit docker.socket has finished start-up
-- Defined-By: systemd

-- Support: http://www.ubuntu.com/support

-- Unit docker.socket has finished starting up.

-- The start-up result is RESULT.
Sep 30 15:35:50 cirrus systemd[1]: docker.service: Start request repeated too quickly.
Sep 30 15:35:50 cirrus systemd[1]: docker.service: Failed with result 'exit-code'.
Sep 30 15:35:50 cirrus systemd[1]: Failed to start Docker Application Container Engine.
-- Subject: Unit docker.service has failed
-- Defined-By: systemd

-- Support: http://www.ubuntu.com/support

-- Unit docker.service has failed.

-- The result is RESULT.
Sep 30 15:35:50 cirrus systemd[1]: docker.socket: Failed with result 'service-start-limit-hit'.
Sep 30 15:36:06 cirrus sshd[1383]: rexec line 121: Deprecated option RSAAuthentication
Sep 30 15:36:08 cirrus sshd[1385]: rexec line 121: Deprecated option RSAAuthentication
Sep 30 15:36:09 cirrus sshd[1385]: reprocess config line 121: Deprecated option RSAAuthentication
Sep 30 15:36:09 cirrus sshd[1385]: Invalid user temp from 157.230.251.115 port 57604
Sep 30 15:36:09 cirrus sshd[1385]: pam_unix(sshd:auth): check pass; user unknown
Sep 30 15:36:09 cirrus sshd[1385]: pam_unix(sshd:auth): authentication failure; logname= uid=0 euid=0 tty=ssh ruser= rhost=157.230.251.115
Sep 30 15:36:11 cirrus sshd[1385]: Failed password for invalid user temp from 157.230.251.115 port 57604 ssh2
Sep 30 15:36:11 cirrus sshd[1385]: Received disconnect from 157.230.251.115 port 57604:11: Bye Bye [preauth]
Sep 30 15:36:11 cirrus sshd[1385]: Disconnected from invalid user temp 157.230.251.115 port 57604 [preauth]
Sep 30 15:36:14 cirrus sshd[1383]: Connection closed by 187.193.143.234 port 45770 [preauth]
Sep 30 15:36:19 cirrus sshd[1387]: rexec line 121: Deprecated option RSAAuthentication
Sep 30 15:36:22 cirrus sudo[1389]: ddowdell : TTY=pts/0 ; PWD=/home/ddowdell ; USER=root ; COMMAND=/bin/journalctl -xe
Sep 30 15:36:22 cirrus sudo[1389]: pam_unix(sudo:session): session opened for user root by ddowdell(uid=0)
ddowdell@cirrus:~$ systemctl status docker
● docker.service - Docker Application Container Engine
Loaded: loaded (/lib/systemd/system/docker.service; enabled; vendor preset: enabled)
Active: failed (Result: exit-code) since Mon 2019-09-30 15:35:50 UTC; 2min 25s ago
Docs: https://docs.docker.com
Process: 1334 ExecStart=/usr/bin/dockerd -H fd:// --containerd=/run/containerd/containerd.sock (code=exited, status=1/FAILURE)
Main PID: 1334 (code=exited, status=1/FAILURE)

I have noticed a difference between docker as installed on bare metal and docker installed on Linode. My bare metal installations create the following network interface for docker:

ddowdell@nimbus:~$ ifconfig
docker0: flags=4099<up,broadcast,multicast> mtu 1500
inet 172.17.0.1 netmask 255.255.0.0 broadcast 172.17.255.255
ether 02:42:39:1d:24:47 txqueuelen 0 (Ethernet)
RX packets 0 bytes 0 (0.0 B)
RX errors 0 dropped 0 overruns 0 frame 0
TX packets 0 bytes 0 (0.0 B)
TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0</up,broadcast,multicast>

Where the Linode installation does not.

Do you have any other suggestions? Thank you.

Testing on a fresh Ubuntu 18.04 deployment, I was able to successfully install Docker following the instructions in our Docs and ensured they matched the steps straight from Docker's website. After a bit of digging, it seems others have been experiencing this issue:

https://github.com/docker/for-linux/issues/606

As simple as it may be, it seems many users were able to correct this behavior by simply rebooting their server. The discussion in the related Debian issue might provide more information.

A reboot does not seem to solve the problem. It's a shame that containerd doesn't provide a more detailed error message.

ddowdell@cirrus:~$ sudo systemctl status docker
[sudo] password for ddowdell:
● docker.service - Docker Application Container Engine
Loaded: loaded (/lib/systemd/system/docker.service; enabled; vendor preset: enabled)
Active: failed (Result: exit-code) since Mon 2019-09-30 18:25:13 UTC; 1min 20s ago
Docs: https://docs.docker.com
Process: 1024 ExecStart=/usr/bin/dockerd -H fd:// --containerd=/run/containerd/containerd.sock (code=exited, s
Main PID: 1024 (code=exited, status=1/FAILURE)
Sep 30 18:25:13 cirrus systemd[1]: docker.service: Service hold-off time over, scheduling restart.
Sep 30 18:25:13 cirrus systemd[1]: docker.service: Scheduled restart job, restart counter is at 3.
Sep 30 18:25:13 cirrus systemd[1]: Stopped Docker Application Container Engine.
Sep 30 18:25:13 cirrus systemd[1]: docker.service: Start request repeated too quickly.
Sep 30 18:25:13 cirrus systemd[1]: docker.service: Failed with result 'exit-code'.
Sep 30 18:25:13 cirrus systemd[1]: Failed to start Docker Application Container Engine.

I have solved my problem, but not the underlying cause. I took the following steps:

  • Cleared my disk and clean installed Ubuntu 18.04.
  • Ran apt update and apt upgrade and then rebooted.
  • I created no other user and ran all the steps in the instructions as root:

https://www.linode.com/docs/applications/containers/install-docker-ce-ubuntu-1804/

  • Ran docker info

Client:
Debug Mode: false
Server:
Containers: 0
Running: 0
Paused: 0
Stopped: 0
Images: 0
Server Version: 19.03.2
Storage Driver: overlay2
Backing Filesystem: extfs
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: 894b81a4b802e4eb2a91d1ce216b8817763c29fb
runc version: 425e105d5a03fabd737a126ad93d62a9eeede87f
init version: fec3683
Security Options:
apparmor
seccomp
Profile: default
Kernel Version: 4.15.0-64-generic
Operating System: Ubuntu 18.04.3 LTS
OSType: linux
Architecture: x86_64
CPUs: 4
Total Memory: 7.79GiB
Name: li1053-196
ID: 2AG6:MCP4:J3FS:VFVN:3MXL:EKY7:F52N:POWA:ZTKC:XPHQ:NBXI:ANYV
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

  • Docker is now behaving normally, so I will now set up users and install the remainder of the apps/servers I need.

  • The anomaly I had noted earlier concerning network interfaces was not present in this install.

docker0: flags=4099<up,broadcast,multicast> mtu 1500
inet 172.17.0.1 netmask 255.255.0.0 broadcast 172.17.255.255
inet6 fe80::42:7eff:fe1e:f2d5 prefixlen 64 scopeid 0x20<link>
ether 02:42:7e:1e:f2:d5 txqueuelen 0 (Ethernet)
RX packets 0 bytes 0 (0.0 B)
RX errors 0 dropped 0 overruns 0 frame 0
TX packets 3 bytes 266 (266.0 B)
TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0</up,broadcast,multicast>

Thank you all for your assistance. I'm also lucky that I was in a position to do a clean Ubuntu installation. Hopefully someone will eventually figure out what short circuited the network interface creation so it won't bite someone else.

Reply

Please enter an answer
Tips:

You can mention users to notify them: @username

You can use Markdown to format your question. For more examples see the Markdown Cheatsheet.

> I’m a blockquote.

I’m a blockquote.

[I'm a link] (https://www.google.com)

I'm a link

**I am bold** I am bold

*I am italicized* I am italicized

Community Code of Conduct