Ubuntu terminal showing the sudo command prompt, ready for Docker installation on Ubuntu 24.04

How to Install Docker on Ubuntu 24.04: Full Setup + Post-Install (2026)

Not on Ubuntu 24.04? On Ubuntu 26.04 LTS or 22.04 LTS the steps below are the same. For Debian 13 or Debian 12, see our Install Docker on Debian guide.

How to Install Docker on Ubuntu 24.04 (Short Answer)

Add Docker’s apt repository and signing key, run sudo apt install docker-ce docker-ce-cli containerd.io docker-buildx-plugin docker-compose-plugin, then check it with sudo docker run hello-world. Do not use the snap package or Ubuntu’s own docker.io. The exact commands are in Steps 1 to 4, followed by the post-install settings most guides skip: the docker group, log rotation, and one daemon.json line to leave out.

Tested on: Ubuntu Server 24.04.5 LTS (cloud image, kernel 6.8.0-147) with Docker Engine 29.9.3, containerd 2.4.2, Docker Compose v5.7.1, Portainer CE 2.45.3 LTS, and the Nginx Proxy Manager and Uptime Kuma 2 images current on 15 November 2026, in a lab VM. Steps 1 to 4, the post-install settings, Portainer, Nginx Proxy Manager and Uptime Kuma were run as written. The Pi-hole section and the troubleshooting fixes were not re-run. Ubuntu 26.04 and 22.04 were not re-run; Docker’s install documentation lists both as supported.

The six stages from a fresh Ubuntu server to a working Docker host
The six stages from a fresh server to a working Docker host.

docker-compose.yml used in the guide: How to Install Docker on Ubuntu 24.04: Full Setu
The docker-compose.yml used in this guide (copy-paste ready).

Why Ubuntu 24.04 Is the Docker Host You Want

I run Docker across six hosts in my homelab, from mini PCs running Proxmox VMs to Raspberry Pis tucked behind the TV. Every single one of them started the same way: a clean Ubuntu install and a Docker setup that takes about ten minutes.

From the homelab: Ubuntu is what most people start with, and it is a solid choice for Docker hosting. I use it on several of my homelab nodes alongside Debian. The Docker installation process is essentially identical between the two.

Ubuntu 24.04 LTS (Noble Numbat) is a long-term support release, with standard security updates until 2029 and no major version jumps along the way. It is no longer the newest LTS: Ubuntu 26.04 LTS (Resolute Raccoon) shipped in April 2026. Docker’s repository supports 26.04, 24.04 and 22.04, and the commands in this guide work unchanged on 26.04, because the repository line picks up your release codename automatically. For a Docker host, that stability matters. You don’t want your container platform shifting underneath you every six months. I’ve been bitten by that on rolling-release distros, and the 3am debugging sessions aren’t worth the newer kernel.

This guide covers the proper way to install Docker on Ubuntu 24.04, not the snap version, not the outdated docker.io package from Ubuntu’s repos, but Docker Engine from Docker’s own repository. I’ll also cover the post-install configuration that most tutorials skip, and the first containers worth running once you’re up.

Prerequisites

Before you start, make sure you have:

  • A machine running Ubuntu 24.04 LTS (server or desktop, both work identically)
  • sudo access on that machine
  • A working internet connection (Docker’s repo needs to be reachable)
  • At least 2 GB of RAM and 20 GB of free disk space (more if you plan to run several containers)

If you’re setting up a dedicated Docker host VM in Proxmox or similar, give it at least 4 GB RAM and 50 GB disk. Containers are lightweight individually, but they accumulate fast. I started with 20 GB on one host and hit 95% disk usage within a month from image layers alone.

If you’re working on a fresh server and need to get comfortable with the basics first, have a read of Linux commands that actually get you hired before continuing.

Step 1: Remove Any Existing Docker Packages

Ubuntu ships with older, unofficial Docker packages in its default repositories. These conflict with the official Docker Engine. Remove them first, even if you don’t think they’re installed:

sudo apt remove $(dpkg --get-selections docker.io docker-compose docker-compose-v2 docker-doc docker-buildx podman-docker containerd runc | cut -f1)
sudo apt autoremove -y

This is the command from Docker’s own install docs. The dpkg --get-selections part only passes on the packages that are actually installed, so it works on a clean machine too. (Listing package names directly with apt remove fails outright if any one of them does not exist, which is why older one-liners often removed nothing.) If dpkg warns that no packages were found, nothing was installed, which is fine. On a fresh Ubuntu 24.04 cloud image it prints several “no packages found” lines and apt removes nothing, which is the expected result.

Step 1 on a fresh Ubuntu 24.04 image: dpkg finds none of the old Docker packages and apt reports nothing to remove
Step 1 on a fresh image: dpkg finds none of the old packages and apt has nothing to remove (0 upgraded, 0 newly installed, 0 to remove).

If you previously installed Docker via snap, remove that too: sudo snap remove docker. The snap version runs in a confined sandbox that causes permission issues with volume mounts and networking. I’ve seen this trip people up more than once, particularly on Ubuntu Desktop where snaps are the default for many packages.

Step 2: Set Up Docker’s Official Repository

This is the part most quick-start guides rush through. We need to add Docker’s GPG key and apt repository so that apt can pull packages directly from Docker.

Install the prerequisites

sudo apt update
sudo apt install -y ca-certificates curl gnupg

apt reports what it finds. On the lab cloud image curl and gnupg were already installed and only ca-certificates was upgraded, so nothing new was added:

sudo apt update followed by sudo apt install -y ca-certificates curl gnupg on a fresh Ubuntu 24.04 cloud image, where curl and gnupg are already the newest version
The prerequisites step on a fresh cloud image: curl and gnupg are already installed and ca-certificates is upgraded. The debconf lines about the Dialog frontend are harmless noise from running apt without a full terminal.

Add Docker’s official GPG key

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

Add the Docker repository to apt sources

echo \
  "deb [arch=$(dpkg --print-architecture) signed-by=/etc/apt/keyrings/docker.asc] https://download.docker.com/linux/ubuntu \
  $(. /etc/os-release && echo "${VERSION_CODENAME}") stable" | \
  sudo tee /etc/apt/sources.list.d/docker.list > /dev/null

Then update your package index so apt knows about the new repository:

sudo apt update

You should see a line referencing download.docker.com in the output. If you don’t, something went wrong with the repository setup. Double-check the commands above.

The Docker GPG key saved into /etc/apt/keyrings, the Docker apt source for noble, and apt update fetching from download.docker.com
The key, the apt source for this release (noble) and apt update fetching from download.docker.com.

Step 3: Install Docker Engine

Now install Docker Engine, the CLI tools, containerd, and the Docker Compose plugin in one command:

sudo apt install -y docker-ce docker-ce-cli containerd.io docker-buildx-plugin docker-compose-plugin

This installs everything you need:

  • docker-ce – The Docker Engine (daemon)
  • docker-ce-cli – The docker command-line tool
  • containerd.io – The container runtime Docker sits on top of
  • docker-buildx-plugin – Extended build capabilities (multi-platform builds)
  • docker-compose-plugin – Docker Compose, integrated as docker compose (no hyphen). The lab install pulled Compose v5.7.1

apt also pulls in docker-ce-rootless-extras and pigz as dependencies, as the output shows:

The end of the apt output when installing docker-ce, docker-ce-cli, containerd.io, docker-buildx-plugin and docker-compose-plugin on Ubuntu 24.04, showing Docker 29.9.3 and Compose 5.7.1 being set up
The engine install: Docker 29.9.3, containerd 2.4.2, Buildx 0.39.0 and Compose 5.7.1 are fetched and set up, with the docker service and socket enabled.

Note that Docker Compose is now a plugin, not a separate binary. The command is docker compose (with a space), not docker-compose (with a hyphen). The old standalone docker-compose is deprecated. If you see tutorials referencing the hyphenated version, they’re outdated.

Step 4: Verify Docker Is Running

Docker should start automatically after installation. Check it:

sudo systemctl status docker

You should see output like:

● docker.service - Docker Application Container Engine
     Loaded: loaded (/usr/lib/systemd/system/docker.service; enabled; preset: enabled)
     Active: active (running) since Sat 2026-04-05 10:15:32 BST; 1min ago
TriggeredBy: ● docker.socket
   Main PID: 1234 (dockerd)
     Memory: 48.3M
        CPU: 1.204s
     CGroup: /system.slice/docker.service
             └─1234 /usr/bin/dockerd -H fd:// --containerd=/run/containerd/containerd.sock

Your dates, process ID and memory figures will differ. The key line is Active: active (running). If it says failed or inactive, check the journal: sudo journalctl -xeu docker.service. For more on reading systemd status output, see mastering systemctl.

systemctl status docker showing the service enabled and active (running), triggered by docker.socket
systemctl status docker on the lab VM: enabled, active (running), and triggered by docker.socket.

Now run the hello-world container to confirm everything works end to end:

sudo docker run hello-world

You should see “Hello from Docker!” followed by a description of what just happened. If you see that, Docker is installed and working.

sudo docker run hello-world pulling the image and printing Hello from Docker
sudo docker run hello-world: the image is pulled and the confirmation message is printed.

Post-Install Configuration

The installation is done, but there are several configuration steps that separate a properly set up Docker host from one that’ll cause you problems later. Most tutorials stop at hello-world. Don’t.

Add your user to the docker group

By default, Docker commands require sudo. You can fix this by adding your user to the docker group:

sudo usermod -aG docker $USER

Log out and back in (or run newgrp docker) for this to take effect. Then test without sudo:

docker run hello-world

If you test in the same session before logging out, it fails with permission denied on /var/run/docker.sock. After a fresh login it works:

usermod adding the user to the docker group, then docker run hello-world in the same session failing with permission denied on the Docker socket
In the same session the new group is not active yet: docker run hello-world is refused with permission denied on /var/run/docker.sock.
After a fresh login, id lists the docker group and docker run hello-world works without sudo
After logging out and back in, id lists the docker group and docker run hello-world works without sudo.

Be aware that adding a user to the docker group grants root-equivalent privileges on the host. Anyone in that group can mount the host filesystem into a container and read or write anything. On a shared server, think carefully about who gets this access. On a dedicated homelab Docker host where you’re the only user, it’s fine.

Enable Docker on boot

Docker should already be enabled to start on boot after installation, but verify it:

sudo systemctl enable docker.service
sudo systemctl enable containerd.service

Configure log rotation

This is the one everyone forgets. Docker containers write logs to JSON files on the host by default, and those files grow without limit. I’ve had containers fill a 50 GB disk with logs in under a week. Configure log rotation in the Docker daemon config:

sudo mkdir -p /etc/docker
sudo tee /etc/docker/daemon.json > /dev/null <<'EOF'
{
  "log-driver": "json-file",
  "log-opts": {
    "max-size": "10m",
    "max-file": "3"
  }
}
EOF

Then restart Docker to apply:

sudo systemctl restart docker

This limits each container’s log file to 10 MB and keeps a maximum of 3 rotated files (the same json-file options are in Docker’s logging documentation). Adjust these values based on your disk space, but having some limit is non-negotiable.

Leave "storage-driver": "overlay2" out. Earlier versions of this guide included it. On Docker Engine 29.0 and later, fresh installs use the containerd image store by default, and Docker’s documentation says upgraded hosts keep the older overlay2 driver until the containerd store is enabled. Forcing overlay2 on a fresh install switches stores. In the lab, hello-world was listed before the restart (containerd snapshotter) and docker images was empty after it (overlay2), because the image sits in the other store:

docker images listing hello-world, then daemon.json with storage-driver overlay2 written and docker restarted, after which docker info reports overlay2 and docker images is empty
Before: hello-world is listed and the driver type is the containerd snapshotter. After adding “storage-driver”: “overlay2” and restarting: Docker reports overlay2 and docker images is empty.

If you have already done this, setting "features": {"containerd-snapshotter": true} in daemon.json and restarting brought the image back in the lab. The catch is that images pulled while overlay2 was active are then hidden instead, so do this before you pull anything you care about:

daemon.json with features containerd-snapshotter true, a docker restart, then docker images listing hello-world again and docker info reporting overlayfs on the containerd snapshotter
The way back: containerd-snapshotter switched on explicitly, and after the restart hello-world is listed again with the containerd snapshotter in use.

The daemon.json file is also where you’d configure insecure registries, default network settings, DNS servers, and more. Keep it minimal to start and add to it as needed. If you run a private registry like Gitea Packages, you’ll configure it here.

Check your versions

Confirm everything is installed and note the versions for your records:

docker version
docker compose version

Expected output (versions will vary):

Client: Docker Engine - Community
 Version:           29.x.x

Server: Docker Engine - Community
 Version:           29.x.x

Docker Compose version v5.x.x

Compose moved from v2 to v5 in the plugin; the command is still docker compose. On the lab install, Docker Engine was 29.9.3 and Compose v5.7.1:

docker version output showing client and server at version 29.9.3 with containerd, runc and docker-init
docker version: client and server 29.9.3, with containerd, runc and docker-init versions.
docker compose version printing v5.7.1
docker compose version: v5.7.1.

Your First Useful Containers

The hello-world container proves Docker works, but it’s not useful. Here are four containers I’d recommend running first on any new Docker host, in order of priority. For the full set of five with a compose file each, a first-run check and the gotcha that catches people, see the five containers every homelab should run.

Portainer – Container Management UI

Portainer gives you a web interface for managing containers, images, volumes, and networks. It’s not a replacement for the CLI, but it’s excellent for getting a quick overview of what’s running.

docker volume create portainer_data

docker run -d \
  --name portainer \
  --restart=always \
  -p 8000:8000 \
  -p 9443:9443 \
  -v /var/run/docker.sock:/var/run/docker.sock \
  -v portainer_data:/data \
  portainer/portainer-ce:lts
The Portainer volume created, the container started with the Docker socket mounted, and docker ps listing it
Portainer started with the guide’s commands: the data volume, the container with the Docker socket mounted, and docker ps.

Access it at https://your-server-ip:9443. The certificate is self-signed, so the browser warns you once. The first page asks you to create the admin user, with a password of at least 12 characters, and a Setup token. Portainer prints the token in its own log:

sudo docker logs portainer 2>&1 | grep -i setup_token
docker logs portainer filtered for setup_token, printing the one-time token line
The token line in Portainer’s log: the value after setup_token= goes in the Setup token field.
Portainer's create-admin page with username, password, confirm password and a Setup token field filled in
Portainer CE 2.45.3 LTS on first visit: the create-admin form with the Setup token field filled from the log (throwaway lab values).

Version 2.45.3 LTS asked for the token in the lab; which earlier releases did was not checked. After you create the user, Portainer offers an optional Edge Compute step (Skip is fine for one Docker host) and an Environment Wizard where the local Docker environment is already connected through the mounted socket:

Portainer's Set up Edge Compute prompt with Continue and Skip buttons
The optional Edge Compute prompt after the admin user is created. Skip is fine for a single host.
Portainer's Environment Wizard saying the local Docker environment is connected, with Get Started and Add Environments tiles
The Environment Wizard: the local Docker environment is already connected, so Get Started is all that is needed.
Portainer's home page listing one environment, the local Docker host, as up
Portainer’s home page after setup: one environment, the local Docker host, up.

Nginx Proxy Manager – Reverse Proxy Made Simple

If you’re going to run multiple web-facing containers, you need a reverse proxy. Nginx Proxy Manager gives you a GUI for managing proxy hosts, SSL certificates (via Let’s Encrypt), and redirects.

mkdir -p ~/nginx-proxy-manager && cd ~/nginx-proxy-manager

cat <<'EOF' > docker-compose.yml
services:
  npm:
    image: jc21/nginx-proxy-manager:latest
    restart: always
    ports:
      - "80:80"
      - "81:81"
      - "443:443"
    volumes:
      - ./data:/data
      - ./letsencrypt:/etc/letsencrypt
EOF

docker compose up -d
The Nginx Proxy Manager compose file, docker compose up -d pulling the image, and docker compose ps showing it running
The guide’s compose file, docker compose up -d, and docker compose ps showing Nginx Proxy Manager up on ports 80, 81 and 443.

Admin UI is on port 81. Since version 2.13.0 there is no default login: a setup wizard asks you to create the admin account on first visit, so do it straight away. (The [email protected] / changeme login in older guides only applies to releases before 2.13.) If you want to access your services remotely and your ISP gives you a dynamic IP, set up DuckDNS for free dynamic DNS so your domain always points to your home network.

Nginx Proxy Manager on port 81 showing a Welcome page that asks you to create your admin account
Nginx Proxy Manager on port 81 right after the first start: a form to create your admin account, with no default login.

Uptime Kuma – Monitoring

You should monitor your services from day one, not after the first outage. Uptime Kuma is a self-hosted monitoring tool that checks HTTP endpoints, TCP ports, DNS, and more. If you want the full walkthrough with notifications and status pages, see our complete Uptime Kuma setup guide.

docker run -d \
  --name uptime-kuma \
  --restart=always \
  -p 3001:3001 \
  -v uptime-kuma:/app/data \
  louislam/uptime-kuma:2
The Uptime Kuma docker run command and docker ps listing the three containers with their ports
The Uptime Kuma container started, shown next to Portainer and Nginx Proxy Manager in docker ps.

Access it at http://your-server-ip:3001. Version 2 asks which database to use before anything else: Embedded MariaDB, MariaDB/MySQL or SQLite. SQLite is a single file, and the on-screen description recommends it for small-scale deployments, so it is the simple choice for a homelab. After that you create the admin account.

Uptime Kuma 2's first-run page asking which database to use, with Embedded MariaDB, MariaDB/MySQL and SQLite options and SQLite selected
Uptime Kuma 2 asks for a database first. SQLite (selected) is a single file and suits a small homelab.
Uptime Kuma's create-your-admin-account form with username, password and repeat password
The create-admin form that follows the database choice (throwaway lab values).

Then add a first monitor: choose HTTP(s), give it a name and a URL. The default check interval is 60 seconds.

Uptime Kuma's Add New Monitor form with type HTTP(s), the name Example website and the URL https://example.com filled in
Adding a first monitor: type HTTP(s), a name and a URL.
Uptime Kuma dashboard showing the Example website monitor as Up with a 200 OK response
The new monitor reports Up with a 200 OK response.

I wrote a full guide on setting up Uptime Kuma for homelab monitoring if you want to go deeper.

Pi-hole – Network-Wide Ad Blocking

If this Docker host sits on your home network, running Pi-hole as a container gives you DNS-level ad blocking for every device on the network.

docker run -d \
  --name pihole \
  --restart=always \
  -p 53:53/tcp \
  -p 53:53/udp \
  -p 8080:80 \
  -e TZ="Europe/London" \
  -e FTLCONF_webserver_api_password="changethis" \
  -e FTLCONF_dns_listeningMode="all" \
  -v pihole_etc:/etc/pihole \
  pihole/pihole:latest

This is for Pi-hole v6. The v5 WEBPASSWORD variable is ignored by v6 (you would get a random password instead), and the /etc/dnsmasq.d volume is optional on a fresh v6 install. FTLCONF_dns_listeningMode=all is needed on Docker’s default bridge network so Pi-hole answers queries from your LAN. The web UI is then at http://your-server-ip:8080/admin.

If you’re running Pi-hole alongside other containers that serve web content, be careful with port 80. In the example above I’ve mapped Pi-hole’s web UI to port 8080 to avoid conflicts. Also note that Ubuntu 24.04 may have systemd-resolved listening on port 53. If Pi-hole fails to start with a port binding error, disable the stub listener and point the host at the real resolver list, or the host itself loses DNS:

sudo mkdir -p /etc/systemd/resolved.conf.d
printf '[Resolve]\nDNSStubListener=no\n' | sudo tee /etc/systemd/resolved.conf.d/no-stub.conf
sudo ln -sf /run/systemd/resolve/resolv.conf /etc/resolv.conf
sudo systemctl restart systemd-resolved

The drop-in file works on 24.04 and 26.04 alike.

Once you are comfortable with running containers, consider deploying Vaultwarden as a self-hosted password manager. It runs as a single container and gives you full control over your credentials instead of trusting a third-party cloud vault.

If you want a first project the rest of the household will actually use, running a Minecraft server in Docker is a good one: one container, one volume for the world, and a real reason to practise backups and updates.

Troubleshooting

These are real issues I’ve hit across my own hosts, not theoretical problems from documentation.

DNS resolution fails inside containers

Symptoms: containers can’t pull images, can’t reach external APIs, apt update inside containers fails. It is not the systemd-resolved stub itself: Docker detects that /etc/resolv.conf only lists 127.0.0.53 and hands containers the real upstream servers from /run/systemd/resolve/resolv.conf instead. Failures usually mean those upstream servers are not reachable from the container network: a resolver that only exists on a VPN interface, split DNS for a local domain, or a firewall blocking DNS from the Docker bridge. Check with cat /run/systemd/resolve/resolv.conf on the host and docker run --rm busybox cat /etc/resolv.conf to see what containers actually get.

Fix: Add explicit DNS servers to your daemon.json:

sudo tee /etc/docker/daemon.json > /dev/null <<'EOF'
{
  "log-driver": "json-file",
  "log-opts": {
    "max-size": "10m",
    "max-file": "3"
  },
  "dns": ["1.1.1.1", "8.8.8.8"]
}
EOF

sudo systemctl restart docker

Or, if you run your own DNS (Pi-hole, for instance), point it to that instead.

Permission denied on mounted volumes

You bind-mount a host directory into a container, and the application inside can’t write to it. This happens because the container’s process runs as a specific UID (often not 1000), and the host directory is owned by your user.

Fix: Check what UID the container expects (docker exec container_name id) and set ownership accordingly:

# Example: many containers run as UID 1000
sudo chown -R 1000:1000 /path/to/mounted/directory

Some containers use environment variables like PUID and PGID to let you specify the user. LinuxServer.io images are good about this.

Disk space disappearing fast

Docker images, stopped containers, and build cache accumulate silently. After a few months of pulling images and rebuilding, you can lose gigabytes to unused data.

Fix: Run a cleanup periodically:

# See what's using space
docker system df

# Remove stopped containers, unused networks, dangling images, and build cache
docker system prune -f

# Nuclear option: also remove unused images (not just dangling)
docker system prune -a -f
docker system df listing images, containers, local volumes and build cache with their sizes
docker system df: where the space goes, by images, containers, volumes and build cache.

Be careful with docker system prune -a, as it removes all images not associated with a running container. If you’ve pulled large images you plan to use later, they’ll be deleted and need re-downloading. The non -a version is safer for routine cleanup.

“Cannot connect to the Docker daemon”

You run a docker command and get told the daemon isn’t running, but you’re sure it is.

Most likely causes:

  • You forgot to add your user to the docker group, or you haven’t logged out and back in since doing so
  • The Docker service genuinely crashed. Check with sudo systemctl status docker
  • You’re in a new shell session where newgrp docker hasn’t been run

Where you’ll meet this at work

The container host you just built maps to managed services. A private image store is Azure Container Registry. Running containers without managing the host is Azure Container Apps, and orchestrating many of them is Azure Kubernetes Service. The reverse proxy in this guide does the job of Azure Application Gateway (a layer 7 load balancer with TLS termination), and Uptime Kuma’s monitors are the home version of Application Insights availability tests.

What maps one to one: images, containers, registries, health checks and log limits mean the same thing. What does not: the host. In those services Azure patches and scales it, so the work you did here (apt repository, docker group, daemon.json, disk clean-up) is the part a managed service removes. Knowing what it removes is what makes the product’s limits and bills make sense.

Running Ubuntu? Here’s What to Do Next

Now that Docker is running, here are five articles to help you build on this foundation:

Practitioner tip: Do not install Docker from Ubuntu’s default apt repository: it is often several versions behind. Always use Docker’s official repository as shown in this guide. The version gap matters for Compose V2 compatibility and security patches.

Key Takeaways

  • Always install Docker Engine from Docker’s official repository, never from Ubuntu’s default repos or via snap
  • Docker Compose is now a plugin (v5.x), so the command is docker compose (space, not hyphen)
  • Configure log rotation in /etc/docker/daemon.json immediately, or container logs will eventually fill your disk, and leave the storage-driver line out on Docker 29
  • Add DNS servers to daemon.json if containers can’t resolve external domains
  • Adding a user to the docker group grants root-equivalent access, so be deliberate about who gets it
  • Run docker system prune periodically to reclaim disk space from unused images and stopped containers
  • Start with Portainer, a reverse proxy, and monitoring before piling on more services

Related Guides

If you found this useful, these guides continue the journey:

The RTM Essential Stack - Gear I Actually Use

Enjoyed this guide?

New articles on Linux, homelab, cloud, and automation every 2 days. No spam, unsubscribe anytime.

Scroll to Top