ServerHandbook live check: run log ------------------------------------------------------------------------------ Article https://serverhandbook.com/kb/install-docker-ubuntu Check scripts/live/checks/install-docker-ubuntu.mjs (sha256 d005486f4d2350af5a264a1a7591aff544588d0c37dd570b24f319a9fecaf358) Ran at 2026-11-15T07:19:35Z (154 s) Result PASS, all 28 claims held Tested on System Ubuntu 26.04.1 LTS Kernel 7.0.0-43-generic Package docker-ce 5:29.9.3-1~ubuntu.26.04~resolute Package docker-ce-cli 5:29.9.3-1~ubuntu.26.04~resolute Package containerd.io 2.4.2-4~ubuntu.26.04~resolute Package docker-buildx-plugin 0.39.0-1~ubuntu.26.04~resolute Package docker-compose-plugin 5.7.1-1~ubuntu.26.04~resolute Package ufw 0.36.2-9build1 Setup A fresh Ubuntu 26.04 server from Ubuntu’s cloud image with ufw on and only SSH allowed, as the ufw article leaves it, reached over SSH as a sudo user. The “other machine” is a second computer on its own network address (192.0.2.2), joined to the server by a virtual cable, so its requests pass through the server’s real firewall. Every version above was read from the server at run time. Passwords used on the throwaway test server are shown as [password]. How we test: https://serverhandbook.com/how-we-test ------------------------------------------------------------------------------ Claims (28), each with what the run saw ------------------------------------------------------------------------------ 1. ok a bare Ubuntu 26.04 server box (web-server) starts 2. ok a fresh server has none of the conflicting packages: apt removes nothing | dpkg: no packages found matching docker.io | dpkg: no packages found matching docker-compose | dpkg: no packages found matching docker-compose-v2 | dpkg: no packages found matching docker-doc | dpkg: no packages found matching podman-docker | dpkg: no packages found matching containerd | dpkg: no packages found matching runc | Summary: | Upgrading: 0, Installing: 0, Removing: 0, Not Upgrading: 0 3. ok apt update fetches the package lists | ] | Get:47 http://archive.ubuntu.com/ubuntu resolute-backports/multiverse amd64 Components [216 B] | Get:48 http://archive.ubuntu.com/ubuntu resolute-backports/multiverse amd64 c-n-f Metadata [120 B] | Fetched 32.7 MB in 18s (1791 kB/s) | 16 packages can be upgraded. Run 'apt list --upgradable' to see them. 4. ok curl is already on the stock image; apt installs or updates ca-certificates | ca-certificates is already the newest version (20260816ubuntu0.26.04.2). | ca-certificates set to manually installed. | curl is already the newest version (8.18.0-1ubuntu2.8). | curl set to manually installed. | Summary: | Upgrading: 0, Installing: 0, Removing: 0, Not Upgrading: 16 5. ok the key downloads to /etc/apt/keyrings/docker.asc (no output) 6. ok the key is Docker Release (CE deb), fingerprint 9DC8 5822 9FC7 DD38 854A E2D8 8D81 803C 0EBF CD88 | gpg: directory '/home/deploy/.gnupg' created | gpg: keybox '/home/deploy/.gnupg/pubring.kbx' created | gpg: /home/deploy/.gnupg/trustdb.gpg: trustdb created | pub rsa4096 2017-02-22 [SCEA] | 9DC858229FC7DD38854AE2D88D81803C0EBFCD88 | uid Docker Release (CE deb) | sub rsa4096 2017-02-22 [S] 7. ok docker.sources is written for resolute, amd64 | Types: deb | URIs: https://download.docker.com/linux/ubuntu | Suites: resolute | Components: stable | Architectures: amd64 | Signed-By: /etc/apt/keyrings/docker.asc 8. ok apt update now reads download.docker.com resolute/stable | Hit:1 http://archive.ubuntu.com/ubuntu resolute InRelease | Hit:2 http://archive.ubuntu.com/ubuntu resolute-updates InRelease | Hit:3 http://archive.ubuntu.com/ubuntu resolute-backports InRelease | Get:4 https://download.docker.com/linux/ubuntu resolute InRelease [32.5 kB] | Get:5 https://download.docker.com/linux/ubuntu resolute/stable amd64 Packages [33.7 kB] | Hit:6 http://security.ubuntu.com/ubuntu resolute-security InRelease | Fetched 66.1 kB in 1s (56.4 kB/s) | 16 packages can be upgraded. Run 'apt list --upgradable' to see them. 9. ok apt-cache policy: docker-ce from download.docker.com, docker.io from the Ubuntu archive | docker-ce: | Installed: (none) | Candidate: 5:29.9.3-1~ubuntu.26.04~resolute | Version table: | 5:29.9.3-1~ubuntu.26.04~resolute 500 | 500 https://download.docker.com/linux/ubuntu resolute/stable amd64 Packages | 5:29.9.2-1~ubuntu.26.04~resolute 500 | 500 https://download.docker.com/linux/ubuntu resolute/stable amd64 Packages | 5:29.9.1-1~ubuntu.26.04~resolute 500 | 500 https://download.docker.com/linux/ubuntu resolute/stable amd64 Packages | 5:29.9.0-1~ubuntu.26.04~resolute 500 | 500 https://download.docker.com/linux/ubuntu resolute/stable amd64 Packages | 5:29.8.2-1~ubuntu.26.04~resolute 500 | 500 https://download.docker.com/linux/ubuntu resolute/stable amd64 Packages | 5:29.8.1-1~ubuntu.26.04~resolute 500 | 500 https://download.docker.com/linux/ubuntu resolute/stable amd64 Packages | 5:29.8.0-1~ubuntu.26.04~resolute 500 | 500 https://download.docker.com/linux/ubuntu resolute/stable amd64 Packages | 5:29.7.2-1~ubuntu.26.04~resolute 500 | 500 https://download.docker.com/linux/ubuntu resolute/stable amd64 Packages | 5:29.7.1-1~ubuntu.26.04~resolute 500 | 500 https://download.docker.com/linux/ubuntu resolute/stable amd64 Packages | 5:29.7.0-1~ubuntu.26.04~resolute 500 | 500 https://download.docker.com/linux/ubuntu resolute/stable amd64 Packages | 5:29.6.2-1~ubuntu.26.04~resolute 500 | 500 https://download.docker.com/linux/ubuntu resolute/stable amd64 Packages | 5:29.6.1-1~ubuntu.26.04~resolute 500 | 500 https://download.docker.com/linux/ubuntu resolute/stable amd64 Packages | 5:29.6.0-1~ubuntu.26.04~resolute 500 | 500 https://download.docker.com/linux/ubuntu resolute/stable amd64 Packages | 5:29.5.3-1~ubuntu.26.04~resolute 500 | 500 https://download.docker.com/linux/ubuntu resolute/stable amd64 Packages | 5:29.5.2-1~ubuntu.26.04~resolute 500 | 500 https://download.docker.com/linux/ubuntu resolute/stable amd64 Packages | 5:29.5.1-1~ubuntu.26.04~resolute 500 | 500 https://download.docker.com/linux/ubuntu resolute/stable amd64 Packages | 5:29.5.0-1~ubuntu.26.04~resolute 500 | 500 https://download.docker.com/linux/ubuntu resolute/stable amd64 Packages | 5:29.4.3-1~ubuntu.26.04~resolute 500 | 500 https://download.docker.com/linux/ubuntu resolute/stable amd64 Packages | 5:29.4.2-2~ubuntu.26.04~resolute 500 | 500 https://download.docker.com/linux/ubuntu resolute/stable amd64 Packages | 5:29.4.2-1~ubuntu.26.04~resolute 500 | 500 https://download.docker.com/linux/ubuntu resolute/stable amd64 Packages | 5:29.4.1-1~ubuntu.26.04~resolute 500 | 500 https://download.docker.com/linux/ubuntu resolute/stable amd64 Packages | 5:29.4.0-1~ubuntu.26.04~resolute 500 | 500 https://download.docker.com/linux/ubuntu resolute/stable amd64 Packages | 5:29.3.1-1~ubuntu.26.04~resolute 500 | 500 https://download.docker.com/linux/ubuntu resolute/stable amd64 Packages | docker.io: | Installed: (none) | Candidate: 29.1.3-0ubuntu4.1 | Version table: | 29.1.3-0ubuntu4.1 500 | 500 http://archive.ubuntu.com/ubuntu resolute-updates/universe amd64 Packages | 500 http://security.ubuntu.com/ubuntu resolute-security/universe amd64 Packages | 29.1.3-0ubuntu4 500 | 500 http://archive.ubuntu.com/ubuntu resolute/universe amd64 Packages 10. ok the five packages install | e-rootless-extras_5%3a29.9.3-1~ubuntu.26.04~resolute_amd64.deb ... | Unpacking docker-ce-rootless-extras (5:29.9.3-1~ubuntu.26.04~resolute) ... | Selecting previously unselected package docker-compose-plugin. | Preparing to unpack .../6-docker-compose-plugin_5.7.1-1~ubuntu.26.04~resolute_amd64.deb ... | Unpacking docker-compose-plugin (5.7.1-1~ubuntu.26.04~resolute) ... | Setting up docker-buildx-plugin (0.39.0-1~ubuntu.26.04~resolute) ... | Setting up containerd.io (2.4.2-4~ubuntu.26.04~resolute) ... | Created symlink '/etc/systemd/system/multi-user.target.wants/containerd.service' → '/usr/lib/systemd/system/containerd.service'. | Setting up docker-compose-plugin (5.7.1-1~ubuntu.26.04~resolute) ... | Setting up docker-ce-cli (5:29.9.3-1~ubuntu.26.04~resolute) ... | Setting up pigz (2.8-1build1) ... | Setting up docker-ce-rootless-extras (5:29.9.3-1~ubuntu.26.04~resolute) ... | Setting up docker-ce (5:29.9.3-1~ubuntu.26.04~resolute) ... | Created symlink '/etc/systemd/system/multi-user.target.wants/docker.service' → '/usr/lib/systemd/system/docker.service'. | Created symlink '/etc/systemd/system/sockets.target.wants/docker.socket' → '/usr/lib/systemd/system/docker.socket'. | Processing triggers for man-db (2.13.1-1build1) ... | | Scanning processes... | Scanning linux images... | | Running kernel seems to be up-to-date. | | No services need to be restarted. | | No containers need to be restarted. | | No user sessions are running outdated binaries. | | No VM guests are running outdated hypervisor (qemu) binaries on this host. 11. ok docker.service is enabled and active (running) | ● docker.service - Docker Application Container Engine | Loaded: loaded (/usr/lib/systemd/system/docker.service; enabled; preset: enabled) | Active: active (running) since Sun 2026-11-15 07:21:22 UTC; 3s ago | Invocation: 244287766acd4a63814b0546ed06ad9e | TriggeredBy: ● docker.socket | Docs: https://docs.docker.com | Main PID: 3528 (dockerd) | Tasks: 9 | Memory: 29.6M (peak: 29.8M) | CPU: 351ms | CGroup: /system.slice/docker.service | └─[0;38:5:245m3528 /usr/bin/dockerd -H fd:// --containerd=/run/containerd/containerd.sock 12. ok docker version: Client and Server: Docker Engine - Community | Client: Docker Engine - Community | Version: 29.9.3 | API version: 1.56 | Go version: go1.26.10 | Git commit: 5457199 | Built: Tue Nov 3 21:42:07 2026 | OS/Arch: linux/amd64 | Context: default | | Server: Docker Engine - Community | Engine: | Version: 29.9.3 | API version: 1.56 (minimum version 1.40) | Go version: go1.26.10 | Git commit: 70efc0e | Built: Tue Nov 3 21:42:07 2026 | OS/Arch: linux/amd64 | Experimental: false | containerd: | Version: v2.4.2 | GitCommit: b7a25261e029d68978bbf290df0a62fc819b3c51 | runc: | Version: 1.5.3 | GitCommit: v1.5.3-0-g46365c62 | docker-init: | Version: 0.19.0 | GitCommit: de40ad0 13. ok sudo docker run hello-world pulls the image and prints "Hello from Docker!" | Unable to find image 'hello-world:latest' locally | latest: Pulling from library/hello-world | | 4f55086f7dd0: Pull complete | Digest: sha256:cf1b20a0c89a666b6950fecda7ccbc1b1a86520e7c53f908f3a21e79d0d60458 | Status: Downloaded newer image for hello-world:latest | | Hello from Docker! | This message shows that your installation appears to be working correctly. | | To generate this message, Docker took the following steps: | 1. The Docker client contacted the Docker daemon. | 2. The Docker daemon pulled the "hello-world" image from the Docker Hub. | (amd64) | 3. The Docker daemon created a new container from that image which runs the | executable that produces the output you are currently reading. | 4. The Docker daemon streamed that output to the Docker client, which sent it | to your terminal. | | To try something more ambitious, you can run an Ubuntu container with: | $ docker run -it ubuntu bash | | Share images, automate workflows, and more with a free Docker ID: | https://hub.docker.com/ | | For more examples and ideas, visit: | https://docs.docker.com/get-started/ 14. ok docker compose version prints the plugin version (v5.x at the time of the run) | Docker Compose version v5.7.1 15. ok docker ps without sudo: permission denied while trying to connect to the docker API at unix:///var/run/docker.sock | permission denied while trying to connect to the docker API at unix:///var/run/docker.sock 16. ok ufw allows OpenSSH only | Status: active | | To Action From | -- ------ ---- | OpenSSH ALLOW Anywhere | OpenSSH (v6) ALLOW Anywhere (v6) 17. ok an nginx container starts with -p 8080:80 | Unable to find image 'nginx:alpine' locally | alpine: Pulling from library/nginx | | da90db506dd5: Pulling fs layer | e011f124249b: Pulling fs layer | 881fc932939e: Pulling fs layer | 1abafee971b9: Pulling fs layer | c7dfd64eeb02: Pulling fs layer | b9c6ee6a30f8: Pulling fs layer | a746bd1dc828: Pulling fs layer | da90db506dd5: Downloading [==> ] 1.049MB/20.55MB | da90db506dd5: Downloading [=====> ] 2.097MB/20.55MB | Digest: sha256:fed7e14be83cbd2661a75cdc5b872d936cf155d46c327084d30b8df19ae88d72 | Status: Downloaded newer image for nginx:alpine | 886308c25f2a6e6387d96e6ad3aa04980198328f6b7cc7f746e3d9560ec886f6 18. ok from another machine: 200, although ufw has no rule for 8080 | 200 19. ok Docker's own DNAT rule sends port 8080 to the container | -A DOCKER ! -i docker0 -p tcp -m tcp --dport 8080 -j DNAT --to-destination 172.17.0.2:80 20. ok the container is replaced (rm -f prints its name) by one published on 127.0.0.1 only | web | ab348d208ca62a4122253e8d05c952acda0021ddb3c055a677ca584838fcc2a1 21. ok from another machine now: no answer, ufw drops it (curl: (28) Connection timed out) | curl: (28) Connection timed out after 5002 milliseconds | 000 22. ok on the server itself it still answers 200 (for a reverse proxy in front) | 200 23. ok docker ps shows 127.0.0.1:8080->80/tcp | web 127.0.0.1:8080->80/tcp 24. ok (tested on) the box reports its OS, kernel and the version of 6 package(s) | PRETTY_NAME="Ubuntu 26.04.1 LTS" | VIRT=none | KERNEL=7.0.0-43-generic | PKG containerd.io 2.4.2-4~ubuntu.26.04~resolute | PKG docker-buildx-plugin 0.39.0-1~ubuntu.26.04~resolute | PKG docker-ce 5:29.9.3-1~ubuntu.26.04~resolute | PKG docker-ce-cli 5:29.9.3-1~ubuntu.26.04~resolute | PKG docker-compose-plugin 5.7.1-1~ubuntu.26.04~resolute | PKG ufw 0.36.2-9build1 25. ok undo: apt purge removes the packages | Removing: 6, Not Upgrading: 16 | Freed space: 388 MB | | | (Reading database ... 91745 files and directories currently installed.) | Removing docker-ce (5:29.9.3-1~ubuntu.26.04~resolute) ... | Removing containerd.io (2.4.2-4~ubuntu.26.04~resolute) ... | Removing docker-buildx-plugin (0.39.0-1~ubuntu.26.04~resolute) ... | Removing docker-ce-cli (5:29.9.3-1~ubuntu.26.04~resolute) ... | Removing docker-ce-rootless-extras (5:29.9.3-1~ubuntu.26.04~resolute) ... | Removing docker-compose-plugin (5.7.1-1~ubuntu.26.04~resolute) ... | Processing triggers for man-db (2.13.1-1build1) ... | (Reading database ... 91521 files and directories currently installed.) | Purging configuration files for docker-ce (5:29.9.3-1~ubuntu.26.04~resolute) ... | Purging configuration files for containerd.io (2.4.2-4~ubuntu.26.04~resolute) ... 26. ok undo: the images and containers are still in /var/lib/docker after the purge | 276K /var/lib/docker | 91M /var/lib/containerd 27. ok undo: the data, the repository and the key are deleted 28. ok undo: the docker command is gone | docker: not installed ------------------------------------------------------------------------------ Commands and what they printed (26) ------------------------------------------------------------------------------ $ sudo apt remove $(dpkg --get-selections docker.io docker-compose docker-compose-v2 docker-doc podman-docker containerd runc | cut -f1) dpkg: no packages found matching docker.io dpkg: no packages found matching docker-compose dpkg: no packages found matching docker-compose-v2 dpkg: no packages found matching docker-doc dpkg: no packages found matching podman-docker dpkg: no packages found matching containerd dpkg: no packages found matching runc Summary: Upgrading: 0, Installing: 0, Removing: 0, Not Upgrading: 0 $ sudo apt update Get:1 http://security.ubuntu.com/ubuntu resolute-security InRelease [137 kB] Hit:2 http://archive.ubuntu.com/ubuntu resolute InRelease Get:3 http://archive.ubuntu.com/ubuntu resolute-updates InRelease [137 kB] Get:4 http://security.ubuntu.com/ubuntu resolute-security/main amd64 Packages [717 kB] Get:5 http://archive.ubuntu.com/ubuntu resolute-backports InRelease [137 kB] Get:6 http://security.ubuntu.com/ubuntu resolute-security/main Translation-en [157 kB] Get:7 http://security.ubuntu.com/ubuntu resolute-security/main amd64 Components [46.7 kB] Get:8 http://security.ubuntu.com/ubuntu resolute-security/universe amd64 Packages [220 kB] Get:9 http://archive.ubuntu.com/ubuntu resolute/universe amd64 Packages [16.0 MB] Get:10 http://security.ubuntu.com/ubuntu resolute-security/universe Translation-en [72.5 kB] Get:11 http://security.ubuntu.com/ubuntu resolute-security/universe amd64 Components [62.7 kB] Get:12 http://security.ubuntu.com/ubuntu resolute-security/universe amd64 c-n-f Metadata [3552 B] Get:13 http://security.ubuntu.com/ubuntu resolute-security/restricted amd64 Packages [586 kB] Get:14 http://security.ubuntu.com/ubuntu resolute-security/restricted Translation-en [122 kB] Get:15 http://security.ubuntu.com/ubuntu resolute-security/multiverse amd64 Packages [20.0 kB] Get:16 http://security.ubuntu.com/ubuntu resolute-security/multiverse Translation-en [3728 B] Get:17 http://security.ubuntu.com/ubuntu resolute-security/multiverse amd64 Components [212 B] Get:18 http://security.ubuntu.com/ubuntu resolute-security/multiverse amd64 c-n-f Metadata [120 B] Get:19 http://archive.ubuntu.com/ubuntu resolute/universe Translation-en [6329 kB] Get:20 http://archive.ubuntu.com/ubuntu resolute/universe amd64 Components [4556 kB] Get:21 http://archive.ubuntu.com/ubuntu resolute/universe amd64 c-n-f Metadata [313 kB] Get:22 http://archive.ubuntu.com/ubuntu resolute/multiverse amd64 Packages [290 kB] Get:23 http://archive.ubuntu.com/ubuntu resolute/multiverse Translation-en [127 kB] Get:24 http://archive.ubuntu.com/ubuntu resolute/multiverse amd64 Components [50.0 kB] Get:25 http://archive.ubuntu.com/ubuntu resolute/multiverse amd64 c-n-f Metadata [8276 B] Get:26 http://archive.ubuntu.com/ubuntu resolute-updates/main amd64 Packages [868 kB] Get:27 http://archive.ubuntu.com/ubuntu resolute-updates/main Translation-en [195 kB] Get:28 http://archive.ubuntu.com/ubuntu resolute-updates/main amd64 Components [110 kB] Get:29 http://archive.ubuntu.com/ubuntu resolute-updates/universe amd64 Packages [389 kB] Get:30 http://archive.ubuntu.com/ubuntu resolute-updates/universe Translation-en [122 kB] Get:31 http://archive.ubuntu.com/ubuntu resolute-updates/universe amd64 Components [201 kB] Get:32 http://archive.ubuntu.com/ubuntu resolute-updates/universe amd64 c-n-f Metadata [4704 B] Get:33 http://archive.ubuntu.com/ubuntu resolute-updates/restricted amd64 Packages [602 kB] Get:34 http://archive.ubuntu.com/ubuntu resolute-updates/restricted Translation-en [125 kB] Get:35 http://archive.ubuntu.com/ubuntu resolute-updates/multiverse amd64 Packages [21.0 kB] Get:36 http://archive.ubuntu.com/ubuntu resolute-updates/multiverse Translation-en [4168 B] Get:37 http://archive.ubuntu.com/ubuntu resolute-updates/multiverse amd64 Components [216 B] Get:38 http://archive.ubuntu.com/ubuntu resolute-updates/multiverse amd64 c-n-f Metadata [256 B] Get:39 http://archive.ubuntu.com/ubuntu resolute-backports/main amd64 Components [212 B] Get:40 http://archive.ubuntu.com/ubuntu resolute-backports/main amd64 c-n-f Metadata [112 B] Get:41 http://archive.ubuntu.com/ubuntu resolute-backports/universe amd64 Packages [3136 B] Get:42 http://archive.ubuntu.com/ubuntu resolute-backports/universe Translation-en [7988 B] Get:43 http://archive.ubuntu.com/ubuntu resolute-backports/universe amd64 Components [1056 B] Get:44 http://archive.ubuntu.com/ubuntu resolute-backports/universe amd64 c-n-f Metadata [116 B] Get:45 http://archive.ubuntu.com/ubuntu resolute-backports/restricted amd64 Components [216 B] Get:46 http://archive.ubuntu.com/ubuntu resolute-backports/restricted amd64 c-n-f Metadata [120 B] Get:47 http://archive.ubuntu.com/ubuntu resolute-backports/multiverse amd64 Components [216 B] Get:48 http://archive.ubuntu.com/ubuntu resolute-backports/multiverse amd64 c-n-f Metadata [120 B] Fetched 32.7 MB in 18s (1791 kB/s) 16 packages can be upgraded. Run 'apt list --upgradable' to see them. $ sudo apt install -y ca-certificates curl ca-certificates is already the newest version (20260816ubuntu0.26.04.2). ca-certificates set to manually installed. curl is already the newest version (8.18.0-1ubuntu2.8). curl set to manually installed. Summary: Upgrading: 0, Installing: 0, Removing: 0, Not Upgrading: 16 $ sudo install -m 0755 -d /etc/apt/keyrings && sudo curl -fsSL https://download.docker.com/linux/ubuntu/gpg -o /etc/apt/keyrings/docker.asc && sudo chmod a+r /etc/apt/keyrings/docker.asc $ gpg --show-keys /etc/apt/keyrings/docker.asc gpg: directory '/home/deploy/.gnupg' created gpg: keybox '/home/deploy/.gnupg/pubring.kbx' created gpg: /home/deploy/.gnupg/trustdb.gpg: trustdb created pub rsa4096 2017-02-22 [SCEA] 9DC858229FC7DD38854AE2D88D81803C0EBFCD88 uid Docker Release (CE deb) sub rsa4096 2017-02-22 [S] $ sudo tee /etc/apt/sources.list.d/docker.sources < ] 1.049MB/20.55MB da90db506dd5: Downloading [=====> ] 2.097MB/20.55MB Digest: sha256:fed7e14be83cbd2661a75cdc5b872d936cf155d46c327084d30b8df19ae88d72 Status: Downloaded newer image for nginx:alpine 886308c25f2a6e6387d96e6ad3aa04980198328f6b7cc7f746e3d9560ec886f6 $ curl -sS -m 5 -o /dev/null -w '%{http_code}\n' http://203.0.113.10:8080 200 $ sudo iptables -t nat -S DOCKER | grep 8080 -A DOCKER ! -i docker0 -p tcp -m tcp --dport 8080 -j DNAT --to-destination 172.17.0.2:80 $ sudo docker rm -f web $ sudo docker run -d --name web -p 127.0.0.1:8080:80 nginx:alpine web ab348d208ca62a4122253e8d05c952acda0021ddb3c055a677ca584838fcc2a1 $ curl -sS -m 5 -o /dev/null -w '%{http_code}\n' http://203.0.113.10:8080 curl: (28) Connection timed out after 5002 milliseconds 000 $ curl -sS -o /dev/null -w '%{http_code}\n' http://127.0.0.1:8080 200 $ sudo docker ps --format "{{.Names}} {{.Ports}}" web 127.0.0.1:8080->80/tcp $ sudo apt purge -y docker-ce docker-ce-cli containerd.io docker-buildx-plugin docker-compose-plugin docker-ce-rootless-extras The following package was automatically installed and is no longer required: pigz Use 'sudo apt autoremove' to remove it. REMOVING: containerd.io* docker-ce* docker-ce-rootless-extras* docker-buildx-plugin* docker-ce-cli* docker-compose-plugin* Summary: Upgrading: 0, Installing: 0, Removing: 6, Not Upgrading: 16 Freed space: 388 MB (Reading database ... 91745 files and directories currently installed.) Removing docker-ce (5:29.9.3-1~ubuntu.26.04~resolute) ... Removing containerd.io (2.4.2-4~ubuntu.26.04~resolute) ... Removing docker-buildx-plugin (0.39.0-1~ubuntu.26.04~resolute) ... Removing docker-ce-cli (5:29.9.3-1~ubuntu.26.04~resolute) ... Removing docker-ce-rootless-extras (5:29.9.3-1~ubuntu.26.04~resolute) ... Removing docker-compose-plugin (5.7.1-1~ubuntu.26.04~resolute) ... Processing triggers for man-db (2.13.1-1build1) ... (Reading database ... 91521 files and directories currently installed.) Purging configuration files for docker-ce (5:29.9.3-1~ubuntu.26.04~resolute) ... Purging configuration files for containerd.io (2.4.2-4~ubuntu.26.04~resolute) ... $ sudo du -sh /var/lib/docker /var/lib/containerd 276K /var/lib/docker 91M /var/lib/containerd $ sudo rm -rf /var/lib/docker /var/lib/containerd && sudo rm /etc/apt/sources.list.d/docker.sources /etc/apt/keyrings/docker.asc $ command -v docker || echo "docker: not installed" docker: not installed ------------------------------------------------------------------------------ The check's source (scripts/live/checks/install-docker-ubuntu.mjs) As it ran. ------------------------------------------------------------------------------ /** * KB: install Docker Engine on Ubuntu 26.04 and 24.04 (one check, run once per release: LIVE_BOX_RELEASE) from Docker's own apt repository (docker.sources, deb822), the five * packages, the service, hello-world, docker compose version; what Ubuntu's docker.io would have given instead * (apt-cache policy); the error plain `docker` gives without sudo (pointer to its own article); the trap no top guide * mentions: a port published with `-p 8080:80` is reachable from outside although ufw allows only SSH, and the fix * (`-p 127.0.0.1:8080:80`). Undo (purge + the data folders + the repository). * * Runs on a fresh server (the local VM box or the rented server). The "other machine" is a network namespace ON the * box ("app", 192.0.2.2) joined by a virtual cable whose server end is 203.0.113.10, so it reaches the server exactly as * the article shows (`curl http://203.0.113.10:8080`), through the server's real kernel, ufw and Docker's rules. */ import { bareBox, reportBox } from '../lib.mjs' export const meta = {} // The release this run boots (LIVE_BOX_RELEASE; plan04 §9: the same check runs on 26.04 and 24.04). const RELEASE = process.env.LIVE_BOX_RELEASE || '24.04' const CODENAME = { '24.04': 'noble', '26.04': 'resolute' }[RELEASE] const SERVER = '203.0.113.10' const APP = '192.0.2.2' const SOURCES = `sudo tee /etc/apt/sources.list.d/docker.sources < bareBox(ctx, async ({ sudoUser }) => { const { run, L } = sudoUser() L('sudo true') // ── hidden: the firewall from the ufw article (SSH only), and the other machine's cable ── L('sudo ufw allow OpenSSH >/dev/null && sudo ufw --force enable >/dev/null') L( [ 'sudo ip netns add app', 'sudo ip link add v-app type veth peer name eth0 netns app', `sudo ip addr add ${SERVER} peer ${APP} dev v-app`, 'sudo ip link set v-app up', `sudo ip netns exec app ip addr add ${APP} peer ${SERVER} dev eth0`, 'sudo ip netns exec app ip link set eth0 up', 'sudo ip netns exec app ip link set lo up', ].join(' && '), ) const onApp = (cmd) => `sudo ip netns exec app runuser -u nobody -- ${cmd}` // ── step 1: nothing old in the way ─────────────────────────────────────────────────────── const rm = run( 'sudo apt remove $(dpkg --get-selections docker.io docker-compose docker-compose-v2 docker-doc podman-docker containerd runc | cut -f1)', { id: 'remove-old', timeout: 300000 }, ) // apt 2.7 (24.04) says "0 to remove", apt 3 (26.04) "Removing: 0" in its Summary block ctx.check('a fresh server has none of the conflicting packages: apt removes nothing', rm.exit === 0 && /0 to remove|Removing: 0\b/.test(rm.out), rm.out) // ── step 2: Docker's key and repository ────────────────────────────────────────────────── const u1 = run('sudo apt update', { id: 'apt-update-1', timeout: 600000 }) // apt 3 (26.04) no longer prints "Reading package lists... Done" after an update ctx.check('apt update fetches the package lists', u1.exit === 0 && /^Fetched .* in /m.test(u1.out) && !/^(W|E): /m.test(u1.out), u1.out.slice(-300)) const pre = run('sudo apt install -y ca-certificates curl', { id: 'apt-prereq', timeout: 600000 }) ctx.check('curl is already on the stock image; apt installs or updates ca-certificates', pre.exit === 0 && /curl is already the newest version/.test(pre.out) && /ca-certificates/.test(pre.out), pre.out) const key = run( 'sudo install -m 0755 -d /etc/apt/keyrings && sudo curl -fsSL https://download.docker.com/linux/ubuntu/gpg -o /etc/apt/keyrings/docker.asc && sudo chmod a+r /etc/apt/keyrings/docker.asc', { id: 'key', timeout: 120000 }, ) ctx.check('the key downloads to /etc/apt/keyrings/docker.asc (no output)', key.exit === 0 && key.out.trim() === '', key.out) const fp = run('gpg --show-keys /etc/apt/keyrings/docker.asc', { id: 'key-fingerprint' }) ctx.check('the key is Docker Release (CE deb), fingerprint 9DC8 5822 9FC7 DD38 854A E2D8 8D81 803C 0EBF CD88', /9DC858229FC7DD38854AE2D88D81803C0EBFCD88/.test(fp.out.replace(/\s/g, '')) && /Docker Release \(CE deb\)/.test(fp.out), fp.out) const src = run(SOURCES, { id: 'sources' }) ctx.check(`docker.sources is written for ${CODENAME}, amd64`, src.exit === 0 && src.out.includes(`Suites: ${CODENAME}`) && /Architectures: amd64/.test(src.out), src.out) const u2 = run('sudo apt update', { id: 'apt-update-2', timeout: 600000 }) ctx.check(`apt update now reads download.docker.com ${CODENAME}/stable`, u2.exit === 0 && u2.out.includes(`download.docker.com/linux/ubuntu ${CODENAME}`) && !/W: |E: /.test(u2.out), u2.out) const pol = run('apt-cache policy docker-ce docker.io', { id: 'policy' }) ctx.check('apt-cache policy: docker-ce from download.docker.com, docker.io from the Ubuntu archive', /docker-ce:\s+Installed: \(none\)\s+Candidate: 5:\d+/.test(pol.out) && /docker\.io:\s+Installed: \(none\)\s+Candidate: \d/.test(pol.out), pol.out) // ── step 3: install ────────────────────────────────────────────────────────────────────── const inst = run('sudo apt install -y docker-ce docker-ce-cli containerd.io docker-buildx-plugin docker-compose-plugin', { id: 'apt-install', timeout: 900000 }) ctx.check('the five packages install', inst.exit === 0 && /Setting up docker-ce /.test(inst.out) && /Setting up docker-compose-plugin /.test(inst.out), inst.out.slice(-1500)) // ── step 4: check it works ─────────────────────────────────────────────────────────────── const st = run('systemctl status docker --no-pager -n 0', { id: 'status' }) ctx.check('docker.service is enabled and active (running)', /docker\.service; enabled;/.test(st.out) && /Active: active \(running\)/.test(st.out), st.out) const ver = run('sudo docker version', { id: 'version' }) ctx.check('docker version: Client and Server: Docker Engine - Community', /Client: Docker Engine - Community/.test(ver.out) && /Server: Docker Engine - Community/.test(ver.out), ver.out) const hw = run('sudo docker run hello-world', { id: 'hello-world', timeout: 300000 }) ctx.check('sudo docker run hello-world pulls the image and prints "Hello from Docker!"', hw.exit === 0 && /Pull complete/.test(hw.out) && /Hello from Docker!/.test(hw.out), hw.out) const cv = run('docker compose version', { id: 'compose-version' }) ctx.check('docker compose version prints the plugin version (v5.x at the time of the run)', /^Docker Compose version v\d+\.\d+\.\d+/m.test(cv.out), cv.out) // ── without sudo ───────────────────────────────────────────────────────────────────────── const ps = run('docker ps', { id: 'no-sudo' }) ctx.check('docker ps without sudo: permission denied while trying to connect to the docker API at unix:///var/run/docker.sock', ps.exit !== 0 && /permission denied while trying to connect to the docker API at unix:\/\/\/var\/run\/docker\.sock/.test(ps.out), ps.out) // ── the firewall trap ──────────────────────────────────────────────────────────────────── const uf = run('sudo ufw status', { id: 'ufw-status' }) ctx.check('ufw allows OpenSSH only', /OpenSSH\s+ALLOW\s+Anywhere/.test(uf.out) && !/8080/.test(uf.out), uf.out) const web = run('sudo docker run -d --name web -p 8080:80 nginx:alpine', { id: 'run-web', timeout: 300000 }) ctx.check('an nginx container starts with -p 8080:80', web.exit === 0 && /[0-9a-f]{64}/.test(web.out), web.out) L('for i in $(seq 1 20); do curl -s -o /dev/null http://127.0.0.1:8080 && break; sleep 1; done') const CURL = `curl -sS -m 5 -o /dev/null -w '%{http_code}\\n' http://${SERVER}:8080` const o1 = run(onApp(CURL), { show: CURL, id: 'outside-open' }) ctx.check('from another machine: 200, although ufw has no rule for 8080', o1.out.trim() === '200', o1.out) const ipt = run('sudo iptables -t nat -S DOCKER | grep 8080', { id: 'nat-rule' }) ctx.check("Docker's own DNAT rule sends port 8080 to the container", /--dport 8080 -j DNAT --to-destination/.test(ipt.out), ipt.out) const web2 = run('sudo docker rm -f web\nsudo docker run -d --name web -p 127.0.0.1:8080:80 nginx:alpine', { id: 'run-web-local' }) ctx.check('the container is replaced (rm -f prints its name) by one published on 127.0.0.1 only', web2.exit === 0 && /^web$/m.test(web2.out) && /[0-9a-f]{64}/.test(web2.out), web2.out) L('for i in $(seq 1 20); do curl -s -o /dev/null http://127.0.0.1:8080 && break; sleep 1; done') const o2 = run(onApp(CURL), { show: CURL, id: 'outside-closed' }) ctx.check('from another machine now: no answer, ufw drops it (curl: (28) Connection timed out)', /curl: \(28\) Connection timed out/.test(o2.out) && !/^200$/m.test(o2.out), o2.out) const loc = run(`curl -sS -o /dev/null -w '%{http_code}\\n' http://127.0.0.1:8080`, { id: 'local-ok' }) ctx.check('on the server itself it still answers 200 (for a reverse proxy in front)', loc.out.trim() === '200', loc.out) const dps = run('sudo docker ps --format "{{.Names}} {{.Ports}}"', { id: 'ps-ports' }) ctx.check('docker ps shows 127.0.0.1:8080->80/tcp', /web\s+127\.0\.0\.1:8080->80\/tcp/.test(dps.out), dps.out) L('sudo docker rm -f web >/dev/null') reportBox( ctx, L, `A fresh Ubuntu ${RELEASE} server from Ubuntu’s cloud image with ufw on and only SSH allowed, as the ufw article leaves it, reached over SSH as a sudo user. The “other machine” is a second computer on its own network address (192.0.2.2), joined to the server by a virtual cable, so its requests pass through the server’s real firewall.`, ['docker-ce', 'docker-ce-cli', 'containerd.io', 'docker-buildx-plugin', 'docker-compose-plugin', 'ufw'], ) // ── undo ───────────────────────────────────────────────────────────────────────────────── const pu = run('sudo apt purge -y docker-ce docker-ce-cli containerd.io docker-buildx-plugin docker-compose-plugin docker-ce-rootless-extras', { id: 'undo-purge', timeout: 600000 }) ctx.check('undo: apt purge removes the packages', pu.exit === 0 && /Removing docker-ce /.test(pu.out), pu.out.slice(-800)) const left = run('sudo du -sh /var/lib/docker /var/lib/containerd', { id: 'undo-left' }) ctx.check('undo: the images and containers are still in /var/lib/docker after the purge', /\/var\/lib\/docker/.test(left.out) && !/No such file/.test(left.out), left.out) const del = run('sudo rm -rf /var/lib/docker /var/lib/containerd && sudo rm /etc/apt/sources.list.d/docker.sources /etc/apt/keyrings/docker.asc', { id: 'undo-rm' }) ctx.check('undo: the data, the repository and the key are deleted', del.exit === 0 && del.out.trim() === '', del.out) const gone = run('command -v docker || echo "docker: not installed"', { id: 'undo-check' }) ctx.check('undo: the docker command is gone', /docker: not installed/.test(gone.out), gone.out) }) export default check