ServerHandbook live check: run log ------------------------------------------------------------------------------ Article https://serverhandbook.com/kb/install-docker-ubuntu-24-04 Check scripts/live/checks/install-docker-ubuntu-24-04.mjs (sha256 4eb75547ead4e70348f06f045f6a11c7ec0d4a67ce5f98e71baac1aedd7a8171) Ran at 2026-11-15T05:58:11Z (166 s) Result PASS, all 28 claims held Tested on System Ubuntu 24.04.5 LTS Kernel 6.8.0-147-generic Package docker-ce 5:29.9.3-1~ubuntu.24.04~noble Package docker-ce-cli 5:29.9.3-1~ubuntu.24.04~noble Package containerd.io 2.4.2-4~ubuntu.24.04~noble Package docker-buildx-plugin 0.39.0-1~ubuntu.24.04~noble Package docker-compose-plugin 5.7.1-1~ubuntu.24.04~noble Package ufw 0.36.2-6 Setup A fresh Ubuntu 24.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 24.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 | Reading package lists... Done | Building dependency tree... Done | Reading state information... Done | 0 upgraded, 0 newly installed, 0 to remove and 0 not upgraded. 3. ok apt update reads the package lists | B] | Get:52 http://archive.ubuntu.com/ubuntu noble-backports/multiverse amd64 c-n-f Metadata [116 B] | Fetched 38.2 MB in 18s (2082 kB/s) | Reading package lists... Done | Building dependency tree... Done | Reading state information... Done | 48 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 | Reading package lists... Done | Building dependency tree... Done | Reading state information... Done | curl is already the newest version (8.5.0-2ubuntu10.16). | curl set to manually installed. | The following packages will be upgraded: | ca-certificates | 1 upgraded, 0 newly installed, 0 to remove and 47 not upgraded. | Need to get 140 kB of archives. | After this operation, 3072 B disk space will be freed. | Get:1 http://archive.ubuntu.com/ubuntu noble-updates/main amd64 ca-certificates all 20260816ubuntu0.24.04.2 [140 kB] | Fetched 140 kB in 2s (81.3 kB/s) | Preconfiguring packages ... | | (Reading database ... 75072 files and directories currently installed.) | Preparing to unpack .../ca-certificates_20260816ubuntu0.24.04.2_all.deb ... | Unpacking ca-certificates (20260816ubuntu0.24.04.2) over (20260601~24.04.1) ... | Setting up ca-certificates (20260816ubuntu0.24.04.2) ... | Updating certificates in /etc/ssl/certs... | rehash: warning: skipping ca-certificates.crt,it does not contain exactly one certificate or CRL | 4 added, 5 removed; done. | Running hooks in /etc/ca-certificates/update.d... | done. | Processing triggers for man-db (2.12.0-4build2) ... | | 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. 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 | 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 noble, amd64 | Types: deb | URIs: https://download.docker.com/linux/ubuntu | Suites: noble | Components: stable | Architectures: amd64 | Signed-By: /etc/apt/keyrings/docker.asc 8. ok apt update now reads download.docker.com noble/stable | Hit:1 http://archive.ubuntu.com/ubuntu noble InRelease | Hit:2 http://archive.ubuntu.com/ubuntu noble-updates InRelease | Get:3 https://download.docker.com/linux/ubuntu noble InRelease [48.5 kB] | Get:4 https://download.docker.com/linux/ubuntu noble/stable amd64 Packages [73.8 kB] | Hit:5 http://security.ubuntu.com/ubuntu noble-security InRelease | Hit:6 http://archive.ubuntu.com/ubuntu noble-backports InRelease | Fetched 122 kB in 1s (87.3 kB/s) | Reading package lists... Done | Building dependency tree... Done | Reading state information... Done | 47 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.24.04~noble | Version table: | 5:29.9.3-1~ubuntu.24.04~noble 500 | 500 https://download.docker.com/linux/ubuntu noble/stable amd64 Packages | 5:29.9.2-1~ubuntu.24.04~noble 500 | 500 https://download.docker.com/linux/ubuntu noble/stable amd64 Packages | 5:29.9.1-1~ubuntu.24.04~noble 500 | 500 https://download.docker.com/linux/ubuntu noble/stable amd64 Packages | 5:29.9.0-1~ubuntu.24.04~noble 500 | 500 https://download.docker.com/linux/ubuntu noble/stable amd64 Packages | 5:29.8.2-1~ubuntu.24.04~noble 500 | 500 https://download.docker.com/linux/ubuntu noble/stable amd64 Packages | 5:29.8.1-1~ubuntu.24.04~noble 500 | 500 https://download.docker.com/linux/ubuntu noble/stable amd64 Packages | 5:29.8.0-1~ubuntu.24.04~noble 500 | 500 https://download.docker.com/linux/ubuntu noble/stable amd64 Packages | 5:29.7.2-1~ubuntu.24.04~noble 500 | 500 https://download.docker.com/linux/ubuntu noble/stable amd64 Packages | 5:29.7.1-1~ubuntu.24.04~noble 500 | 500 https://download.docker.com/linux/ubuntu noble/stable amd64 Packages | 5:29.7.0-1~ubuntu.24.04~noble 500 | 500 https://download.docker.com/linux/ubuntu noble/stable amd64 Packages | 5:29.6.2-1~ubuntu.24.04~noble 500 | 500 https://download.docker.com/linux/ubuntu noble/stable amd64 Packages | 5:29.6.1-1~ubuntu.24.04~noble 500 | 500 https://download.docker.com/linux/ubuntu noble/stable amd64 Packages | 5:29.6.0-1~ubuntu.24.04~noble 500 | 500 https://download.docker.com/linux/ubuntu noble/stable amd64 Packages | 5:29.5.3-1~ubuntu.24.04~noble 500 | 500 https://download.docker.com/linux/ubuntu noble/stable amd64 Packages | 5:29.5.2-1~ubuntu.24.04~noble 500 | 500 https://download.docker.com/linux/ubuntu noble/stable amd64 Packages | 5:29.5.1-1~ubuntu.24.04~noble 500 | 500 https://download.docker.com/linux/ubuntu noble/stable amd64 Packages | 5:29.5.0-1~ubuntu.24.04~noble 500 | 500 https://download.docker.com/linux/ubuntu noble/stable amd64 Packages | 5:29.4.3-1~ubuntu.24.04~noble 500 | 500 https://download.docker.com/linux/ubuntu noble/stable amd64 Packages | 5:29.4.2-2~ubuntu.24.04~noble 500 | 500 https://download.docker.com/linux/ubuntu noble/stable amd64 Packages | 5:29.4.2-1~ubuntu.24.04~noble 500 | 500 https://download.docker.com/linux/ubuntu noble/stable amd64 Packages | 5:29.4.1-1~ubuntu.24.04~noble 500 | 500 https://download.docker.com/linux/ubuntu noble/stable amd64 Packages | 5:29.4.0-1~ubuntu.24.04~noble 500 | 500 https://download.docker.com/linux/ubuntu noble/stable amd64 Packages | 5:29.3.1-1~ubuntu.24.04~noble 500 | 500 https://download.docker.com/linux/ubuntu noble/stable amd64 Packages | 5:29.3.0-1~ubuntu.24.04~noble 500 | 500 https://download.docker.com/linux/ubuntu noble/stable amd64 Packages | 5:29.2.1-1~ubuntu.24.04~noble 500 | 500 https://download.docker.com/linux/ubuntu noble/stable amd64 Packages | 5:29.2.0-1~ubuntu.24.04~noble 500 | 500 https://download.docker.com/linux/ubuntu noble/stable amd64 Packages | 5:29.1.5-1~ubuntu.24.04~noble 500 | 500 https://download.docker.com/linux/ubuntu noble/stable amd64 Packages | 5:29.1.4-1~ubuntu.24.04~noble 500 | 500 https://download.docker.com/linux/ubuntu noble/stable amd64 Packages | 5:29.1.3-1~ubuntu.24.04~noble 500 | 500 https://download.docker.com/linux/ubuntu noble/stable amd64 Packages | 5:29.1.2-1~ubuntu.24.04~noble 500 | 500 https://download.docker.com/linux/ubuntu noble/stable amd64 Packages | 5:29.1.1-1~ubuntu.24.04~noble 500 | 500 https://download.docker.com/linux/ubuntu noble/stable amd64 Packages | 5:29.1.0-1~ubuntu.24.04~noble 500 | 500 https://download.docker.com/linux/ubuntu noble/stable amd64 Packages | 5:29.0.4-1~ubuntu.24.04~noble 500 | 500 https://download.d 10. ok the five packages install | tless-extras. | Preparing to unpack .../5-docker-ce-rootless-extras_5%3a29.9.3-1~ubuntu.24.04~noble_amd64.deb ... | Unpacking docker-ce-rootless-extras (5:29.9.3-1~ubuntu.24.04~noble) ... | Selecting previously unselected package docker-compose-plugin. | Preparing to unpack .../6-docker-compose-plugin_5.7.1-1~ubuntu.24.04~noble_amd64.deb ... | Unpacking docker-compose-plugin (5.7.1-1~ubuntu.24.04~noble) ... | Setting up docker-buildx-plugin (0.39.0-1~ubuntu.24.04~noble) ... | Setting up containerd.io (2.4.2-4~ubuntu.24.04~noble) ... | 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.24.04~noble) ... | Setting up docker-ce-cli (5:29.9.3-1~ubuntu.24.04~noble) ... | Setting up pigz (2.8-1) ... | Setting up docker-ce-rootless-extras (5:29.9.3-1~ubuntu.24.04~noble) ... | Setting up docker-ce (5:29.9.3-1~ubuntu.24.04~noble) ... | 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.12.0-4build2) ... | | 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 06:00:05 UTC; 3s ago | TriggeredBy: ● docker.socket | Docs: https://docs.docker.com | Main PID: 8139 (dockerd) | Tasks: 9 | Memory: 28.4M (peak: 28.9M) | CPU: 477ms | CGroup: /system.slice/docker.service | └─8139 /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:41:31 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:41:31 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 | 881fc932939e: Pulling fs layer | a746bd1dc828: Pulling fs layer | e011f124249b: Pulling fs layer | 1abafee971b9: Pulling fs layer | b9c6ee6a30f8: Pulling fs layer | 69d81d552257: Pulling fs layer | 881fc932939e: Downloading [===========================> ] 2.097MB/3.854MB | 881fc932939e: Downloading [========================================> ] 3.146MB/3.854MB | Digest: sha256:fed7e14be83cbd2661a75cdc5b872d936cf155d46c327084d30b8df19ae88d72 | Status: Downloaded newer image for nginx:alpine | e477f271380ae752affe2982eff8ca9a577a6b9541f26dbe644a9f90c370e19c 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 | 9c6b262bf6c22453c6f9ce7f1d6a2399be69b340d5c6c3652daf74ca3e3777bc 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 24.04.5 LTS" | VIRT=none | KERNEL=6.8.0-147-generic | PKG containerd.io 2.4.2-4~ubuntu.24.04~noble | PKG docker-buildx-plugin 0.39.0-1~ubuntu.24.04~noble | PKG docker-ce 5:29.9.3-1~ubuntu.24.04~noble | PKG docker-ce-cli 5:29.9.3-1~ubuntu.24.04~noble | PKG docker-compose-plugin 5.7.1-1~ubuntu.24.04~noble | PKG ufw 0.36.2-6 25. ok undo: apt purge removes the packages | e and 47 not upgraded. | After this operation, 388 MB disk space will be freed. | | (Reading database ... 75308 files and directories currently installed.) | Removing docker-ce (5:29.9.3-1~ubuntu.24.04~noble) ... | Removing containerd.io (2.4.2-4~ubuntu.24.04~noble) ... | Removing docker-buildx-plugin (0.39.0-1~ubuntu.24.04~noble) ... | Removing docker-ce-cli (5:29.9.3-1~ubuntu.24.04~noble) ... | Removing docker-ce-rootless-extras (5:29.9.3-1~ubuntu.24.04~noble) ... | Removing docker-compose-plugin (5.7.1-1~ubuntu.24.04~noble) ... | Processing triggers for man-db (2.12.0-4build2) ... | (Reading database ... 75084 files and directories currently installed.) | Purging configuration files for docker-ce (5:29.9.3-1~ubuntu.24.04~noble) ... | Purging configuration files for containerd.io (2.4.2-4~ubuntu.24.04~noble) ... 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 Reading package lists... Done Building dependency tree... Done Reading state information... Done 0 upgraded, 0 newly installed, 0 to remove and 0 not upgraded. $ sudo apt update Hit:1 http://archive.ubuntu.com/ubuntu noble InRelease Get:2 http://archive.ubuntu.com/ubuntu noble-updates InRelease [126 kB] Get:3 http://security.ubuntu.com/ubuntu noble-security InRelease [126 kB] Get:4 http://archive.ubuntu.com/ubuntu noble-backports InRelease [126 kB] Get:5 http://archive.ubuntu.com/ubuntu noble/universe amd64 Packages [15.0 MB] Get:6 http://security.ubuntu.com/ubuntu noble-security/main amd64 Packages [1195 kB] Get:7 http://security.ubuntu.com/ubuntu noble-security/main Translation-en [238 kB] Get:8 http://security.ubuntu.com/ubuntu noble-security/main amd64 Components [46.4 kB] Get:9 http://security.ubuntu.com/ubuntu noble-security/universe amd64 Packages [1228 kB] Get:10 http://security.ubuntu.com/ubuntu noble-security/universe Translation-en [248 kB] Get:11 http://security.ubuntu.com/ubuntu noble-security/universe amd64 Components [76.3 kB] Get:12 http://security.ubuntu.com/ubuntu noble-security/universe amd64 c-n-f Metadata [24.2 kB] Get:13 http://security.ubuntu.com/ubuntu noble-security/restricted amd64 Packages [1788 kB] Get:14 http://security.ubuntu.com/ubuntu noble-security/restricted Translation-en [411 kB] Get:15 http://security.ubuntu.com/ubuntu noble-security/multiverse amd64 Packages [45.4 kB] Get:16 http://security.ubuntu.com/ubuntu noble-security/multiverse Translation-en [12.4 kB] Get:17 http://security.ubuntu.com/ubuntu noble-security/multiverse amd64 Components [208 B] Get:18 http://security.ubuntu.com/ubuntu noble-security/multiverse amd64 c-n-f Metadata [468 B] Get:19 http://archive.ubuntu.com/ubuntu noble/universe Translation-en [5982 kB] Get:20 http://archive.ubuntu.com/ubuntu noble/universe amd64 Components [3871 kB] Get:21 http://archive.ubuntu.com/ubuntu noble/universe amd64 c-n-f Metadata [301 kB] Get:22 http://archive.ubuntu.com/ubuntu noble/multiverse amd64 Packages [269 kB] Get:23 http://archive.ubuntu.com/ubuntu noble/multiverse Translation-en [118 kB] Get:24 http://archive.ubuntu.com/ubuntu noble/multiverse amd64 Components [35.0 kB] Get:25 http://archive.ubuntu.com/ubuntu noble/multiverse amd64 c-n-f Metadata [8328 B] Get:26 http://archive.ubuntu.com/ubuntu noble-updates/main amd64 Packages [1450 kB] Get:27 http://archive.ubuntu.com/ubuntu noble-updates/main Translation-en [315 kB] Get:28 http://archive.ubuntu.com/ubuntu noble-updates/main amd64 Components [181 kB] Get:29 http://archive.ubuntu.com/ubuntu noble-updates/universe amd64 Packages [1713 kB] Get:30 http://archive.ubuntu.com/ubuntu noble-updates/universe Translation-en [345 kB] Get:31 http://archive.ubuntu.com/ubuntu noble-updates/universe amd64 Components [388 kB] Get:32 http://archive.ubuntu.com/ubuntu noble-updates/universe amd64 c-n-f Metadata [34.9 kB] Get:33 http://archive.ubuntu.com/ubuntu noble-updates/restricted amd64 Packages [1883 kB] Get:34 http://archive.ubuntu.com/ubuntu noble-updates/restricted Translation-en [430 kB] Get:35 http://archive.ubuntu.com/ubuntu noble-updates/multiverse amd64 Packages [50.7 kB] Get:36 http://archive.ubuntu.com/ubuntu noble-updates/multiverse Translation-en [14.6 kB] Get:37 http://archive.ubuntu.com/ubuntu noble-updates/multiverse amd64 Components [940 B] Get:38 http://archive.ubuntu.com/ubuntu noble-updates/multiverse amd64 c-n-f Metadata [656 B] Get:39 http://archive.ubuntu.com/ubuntu noble-backports/main amd64 Packages [40.6 kB] Get:40 http://archive.ubuntu.com/ubuntu noble-backports/main Translation-en [9172 B] Get:41 http://archive.ubuntu.com/ubuntu noble-backports/main amd64 Components [5744 B] Get:42 http://archive.ubuntu.com/ubuntu noble-backports/main amd64 c-n-f Metadata [368 B] Get:43 http://archive.ubuntu.com/ubuntu noble-backports/universe amd64 Packages [31.0 kB] Get:44 http://archive.ubuntu.com/ubuntu noble-backports/universe Translation-en [18.6 kB] Get:45 http://archive.ubuntu.com/ubuntu noble-backports/universe amd64 Components [12.6 kB] Get:46 http://archive.ubuntu.com/ubuntu noble-backports/universe amd64 c-n-f Metadata [1588 B] Get:47 http://archive.ubuntu.com/ubuntu noble-backports/restricted amd64 Components [212 B] Get:48 http://archive.ubuntu.com/ubuntu noble-backports/restricted amd64 c-n-f Metadata [116 B] Get:49 http://archive.ubuntu.com/ubuntu noble-backports/multiverse amd64 Packages [748 B] Get:50 http://archive.ubuntu.com/ubuntu noble-backports/multiverse Translation-en [340 B] Get:51 http://archive.ubuntu.com/ubuntu noble-backports/multiverse amd64 Components [212 B] Get:52 http://archive.ubuntu.com/ubuntu noble-backports/multiverse amd64 c-n-f Metadata [116 B] Fetched 38.2 MB in 18s (2082 kB/s) Reading package lists... Done Building dependency tree... Done Reading state information... Done 48 packages can be upgraded. Run 'apt list --upgradable' to see them. $ sudo apt install -y ca-certificates curl Reading package lists... Done Building dependency tree... Done Reading state information... Done curl is already the newest version (8.5.0-2ubuntu10.16). curl set to manually installed. The following packages will be upgraded: ca-certificates 1 upgraded, 0 newly installed, 0 to remove and 47 not upgraded. Need to get 140 kB of archives. After this operation, 3072 B disk space will be freed. Get:1 http://archive.ubuntu.com/ubuntu noble-updates/main amd64 ca-certificates all 20260816ubuntu0.24.04.2 [140 kB] Fetched 140 kB in 2s (81.3 kB/s) Preconfiguring packages ... (Reading database ... 75072 files and directories currently installed.) Preparing to unpack .../ca-certificates_20260816ubuntu0.24.04.2_all.deb ... Unpacking ca-certificates (20260816ubuntu0.24.04.2) over (20260601~24.04.1) ... Setting up ca-certificates (20260816ubuntu0.24.04.2) ... Updating certificates in /etc/ssl/certs... rehash: warning: skipping ca-certificates.crt,it does not contain exactly one certificate or CRL 4 added, 5 removed; done. Running hooks in /etc/ca-certificates/update.d... done. Processing triggers for man-db (2.12.0-4build2) ... 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. $ 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 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 < ] 2.097MB/3.854MB 881fc932939e: Downloading [========================================> ] 3.146MB/3.854MB Digest: sha256:fed7e14be83cbd2661a75cdc5b872d936cf155d46c327084d30b8df19ae88d72 Status: Downloaded newer image for nginx:alpine e477f271380ae752affe2982eff8ca9a577a6b9541f26dbe644a9f90c370e19c $ 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 9c6b262bf6c22453c6f9ce7f1d6a2399be69b340d5c6c3652daf74ca3e3777bc $ 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 Reading package lists... Done Building dependency tree... Done Reading state information... Done The following package was automatically installed and is no longer required: pigz Use 'sudo apt autoremove' to remove it. The following packages will be REMOVED: containerd.io* docker-buildx-plugin* docker-ce* docker-ce-cli* docker-ce-rootless-extras* docker-compose-plugin* 0 upgraded, 0 newly installed, 6 to remove and 47 not upgraded. After this operation, 388 MB disk space will be freed. (Reading database ... 75308 files and directories currently installed.) Removing docker-ce (5:29.9.3-1~ubuntu.24.04~noble) ... Removing containerd.io (2.4.2-4~ubuntu.24.04~noble) ... Removing docker-buildx-plugin (0.39.0-1~ubuntu.24.04~noble) ... Removing docker-ce-cli (5:29.9.3-1~ubuntu.24.04~noble) ... Removing docker-ce-rootless-extras (5:29.9.3-1~ubuntu.24.04~noble) ... Removing docker-compose-plugin (5.7.1-1~ubuntu.24.04~noble) ... Processing triggers for man-db (2.12.0-4build2) ... (Reading database ... 75084 files and directories currently installed.) Purging configuration files for docker-ce (5:29.9.3-1~ubuntu.24.04~noble) ... Purging configuration files for containerd.io (2.4.2-4~ubuntu.24.04~noble) ... $ 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-24-04.mjs) As it ran. ------------------------------------------------------------------------------ /** * KB: install Docker Engine on Ubuntu 24.04 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 = {} 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 }, ) ctx.check('a fresh server has none of the conflicting packages: apt removes nothing', rm.exit === 0 && /0 to remove/.test(rm.out), rm.out) // ── step 2: Docker's key and repository ────────────────────────────────────────────────── const u1 = run('sudo apt update', { id: 'apt-update-1', timeout: 600000 }) ctx.check('apt update reads the package lists', u1.exit === 0 && /Reading package lists/.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 noble, amd64', src.exit === 0 && /Suites: noble/.test(src.out) && /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 noble/stable', u2.exit === 0 && /download\.docker\.com\/linux\/ubuntu noble/.test(u2.out) && !/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 24.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.', ['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