How to Install Docker on Ubuntu 24.04 (Step-by-Step Guide)
Docker installs on Ubuntu 24.04 in about ten minutes when you use Docker’s official apt repository: add Docker’s signing key, add the repository, install five packages, then prove it works with the hello-world test container. This guide follows that method only, because it is the one Docker documents and supports for Ubuntu 24.04, and it gives you normal apt updates afterwards.
Docker Engine is the software that builds and runs containers on Linux. A container packages an application with everything it needs to run, so the same container runs the same way on your laptop and on a server. Docker Compose, which arrives as a plugin in this install, starts multi-container applications from a single file. You need a 64-bit install of Ubuntu 24.04 LTS, codenamed Noble, a user account with sudo rights, a terminal, and an internet connection. Every command in this guide was checked against Docker’s official installation documentation for Ubuntu.
Check your system before you start
Two quick checks first. Confirm you are on Ubuntu 24.04, then remove any unofficial Docker packages, because Docker’s documentation says they conflict with the official packages and must go before you install.
If Ubuntu is not installed on this machine yet, install it first with our guide to installing Ubuntu 24.04 LTS step by step, then come back here.
- Open a terminal. On the desktop, press Ctrl plus Alt plus T.
- Check the Ubuntu version with this command:
Look for the line that reads VERSION_CODENAME=noble. If it says something else, you are on a different Ubuntu release and the repository file below will point at the wrong packages.cat /etc/os-release - Check the processor architecture with this command:
Most desktop PCs and laptops print amd64. The repository setup below detects yours automatically, so you do not need to type it by hand.dpkg --print-architecture - Remove any conflicting Docker packages that Ubuntu or another tutorial may have installed:
If apt reports that none of these packages are installed, that is fine. It means you are starting clean.sudo apt remove $(dpkg --get-selections docker.io docker-compose docker-compose-v2 docker-doc docker-buildx podman-docker containerd runc | cut -f1) - Update the package lists and upgrade what is already installed:
sudo apt update sudo apt upgrade -y
The remove command looks unusual, so here is what it does. The dpkg part lists which of the named packages are actually installed, and cut takes just the package names. Apt then removes only those names, so the command works whether or not any of them are present.
Why the official repository, and not the snap or the convenience script
Ubuntu offers more than one way to get Docker, and most failures beginners hit come from picking the wrong one. Docker’s own install page for Ubuntu lists four methods: Docker Desktop, the apt repository, manual .deb packages, and the convenience script. The snap is not among them. That absence is the point. The repository method is the only one that gives you Docker’s own signed packages, managed by apt, with updates arriving through the normal update process.
Ubuntu’s own docker.io package is the one many tutorials still reach for, because it installs with a single command. Docker’s documentation calls these distribution packages unofficial and says they conflict with the official packages. They are built and updated on Ubuntu’s release cycle, not Docker’s, so they lag behind Docker’s current releases. Installing docker.io first and then adding Docker’s repository on top of it leaves two half-installed versions of Docker fighting over the same files.
The snap package looks convenient for the same reason, and it is easy to find in the software store. It is maintained by Canonical, not by Docker, and it follows the snap release cycle rather than Docker’s. The snap is a separate packaging of Docker, so its version and update timing can differ from the Docker Engine that Docker’s own documentation describes. For a first install, that difference is pure risk with no benefit. Docker Desktop, the remaining option on Docker’s list, bundles Engine with a graphical interface, but it is a different product with its own installer and licensing terms.
The convenience script is the one-line install many guides print: curl a script from get.docker.com and pipe it into a shell. Docker’s documentation is clear about it. The script is only recommended for testing and development, not for production, and Docker warns that it installs the latest stable release without asking, gives you almost no way to customise the installation, and can pull in a large number of packages. Running a script downloaded from the internet, as root, without reading it first is a habit worth breaking early.
Add Docker’s official GPG key and repository
This is the part where beginners most often go wrong, and it is worth doing slowly. Apt needs two things before it will install Docker’s packages: proof that the packages really come from Docker, and the address of Docker’s repository. The proof is a signing key. The address is a source file. Get either one wrong and apt refuses to install anything. Docker documents this exact sequence on its Ubuntu install page. See Docker Docs: Install Docker Engine on Ubuntu.
- Install the two helper packages the setup needs:
sudo apt update sudo apt install ca-certificates curl - Create the folder where apt keeps repository signing keys:
The -m 0755 part sets the folder permissions so apt can read what goes inside it. Older tutorials put keys in a shared keyring with apt-key, which Ubuntu has deprecated.sudo install -m 0755 -d /etc/apt/keyrings - Download Docker’s official signing key into that folder:
The key lands in a file called docker.asc.sudo curl -fsSL https://download.docker.com/linux/ubuntu/gpg -o /etc/apt/keyrings/docker.asc - Make the key file readable by apt:
Skip this line and apt cannot read the key, which produces a signature error on the next update.sudo chmod a+r /etc/apt/keyrings/docker.asc - Add Docker’s repository to apt. This command writes a source file in the Deb822 format that current Ubuntu versions prefer:
Type it exactly, including the EOF lines. The tee command writes the text between them into the file docker.sources.sudo tee /etc/apt/sources.list.d/docker.sources <<EOF Types: deb URIs: https://download.docker.com/linux/ubuntu Suites: $(. /etc/os-release && echo "${UBUNTU_CODENAME:-$VERSION_CODENAME}") Components: stable Architectures: $(dpkg --print-architecture) Signed-By: /etc/apt/keyrings/docker.asc EOF - Update the package lists so apt sees Docker’s packages:
If this update finishes without errors, the repository is set up correctly. If it shows a key error or a 404 error, do not continue to the install. The fix section near the end of this guide covers the errors that cause this, and each one traces back to a mistake in the steps above.sudo apt update
What the repository file actually says
Each line of the source file has one job. Types: deb says this is a binary package repository. URIs gives the address of Docker’s Ubuntu repository. Suites names the Ubuntu release, and the command inside it reads your release codename from /etc/os-release, which is noble on Ubuntu 24.04. Components: stable says you want Docker’s stable packages rather than test or nightly builds. Architectures fills in your processor architecture from dpkg. Signed-By points apt at the key you downloaded, so apt can check every package against Docker’s signature before installing it.
Two details matter here. Name the file docker.sources, not docker.list: older tutorials used the one-line docker.list format, and mixing the two causes duplicate-repository warnings. And the Suites line must say noble. A repository line copied from a tutorial written for Ubuntu 22.04 says jammy, and apt will look for Docker packages for the wrong release and fail.
Install Docker Engine and the five packages
With the repository in place, the install itself is a single command. Docker’s documentation installs five packages together, and you want all five even if you only plan to run simple containers. The Compose plugin in particular is the tool most tutorials assume you have.
- Install the packages:
Apt lists the packages and their size and asks you to confirm. Press Y and Enter, or add -y to the command to confirm automatically.sudo apt install docker-ce docker-ce-cli containerd.io docker-buildx-plugin docker-compose-plugin - Wait for the install to finish. Apt downloads the packages from Docker’s repository, installs them, and starts the Docker service, which starts on boot by default on Ubuntu.
| Package | What it does |
|---|---|
| docker-ce | Docker Engine, the daemon that builds and runs containers |
| docker-ce-cli | The docker command you type in the terminal |
| containerd.io | The container runtime that actually runs the containers |
| docker-buildx-plugin | Buildx, the tool that builds container images |
| docker-compose-plugin | Compose, which starts multi-container apps from one file |
The package names are Docker’s own, and the ce in docker-ce stands for Community Edition, the free version of Docker Engine. If apt answers “Unable to locate package docker-ce”, the repository was not added correctly or the apt update after adding it did not run. That error is covered in the fix section below.
Check Docker is running and run hello-world
Do not skip the verification. An install that reports success but never runs a container is not a finished install, and the hello-world test is the check Docker’s own documentation uses. It downloads a tiny test image, runs it in a container, and the container prints a confirmation message and exits.
- Check the Docker service is running:
Look for the line that says Active: active (running), then press Q to leave the status view. If the service is not running, start it with sudo systemctl start docker and check the status again.sudo systemctl status docker - Run the test container:
The first run downloads the hello-world image, then runs it. You should see a message that begins “Hello from Docker!” and explains that the installation appears to be working correctly. That message is the proof.sudo docker run hello-world - Confirm the version Docker installed, which is useful when you ask for help later:
The first prints the Engine version and the second prints the Compose plugin version. Both work with sudo in front of them at this stage; the next section removes the need for sudo.docker --version docker compose version
Three results are possible from the hello-world run. A printed hello-world message means the install worked. A permission denied error about the Docker socket means your user is not in the docker group yet, which the next section fixes. A message that the Docker daemon is not running means the service stopped, and starting it with systemctl is the fix.
Run Docker without sudo
By default, only the root user can talk to the Docker daemon, because the daemon listens on a Unix socket owned by root. That is why every command so far started with sudo. Docker’s post-installation documentation gives the standard fix: add your user to the docker group. See Docker Docs: Post-installation steps for Linux.
- Create the docker group. On some systems the install already created it, in which case groupadd reports that the group exists:
sudo groupadd docker - Add your own user to the group. The $USER part fills in your username automatically, and -aG appends the group to your account without removing your other groups. Never leave out the -a, or you will remove yourself from every other group, including sudo:
sudo usermod -aG docker $USER - Log out and log back in so Ubuntu re-reads your group membership. To activate the change in the current terminal without logging out, run:
This opens a shell with the docker group active for the current terminal only, so logging out and back in is still the cleaner fix.newgrp docker - Verify you can run Docker without sudo:
If it prints the hello-world message, the group setup worked.docker run hello-world
One warning belongs here, because Docker’s documentation states it plainly. Membership in the docker group grants root-level privileges. Anyone who can run Docker containers can start a container that mounts the host filesystem and reads or changes files as root. On a personal machine that is an accepted trade-off, but on a shared machine do not add users to the docker group casually.
Fix the .docker permission error after using sudo
If you ran Docker commands with sudo before adding yourself to the group, you may now see a warning about a permission denied error on /home/your-name/.docker/config.json. The earlier sudo runs created the .docker folder owned by root, and your normal user cannot write to it. Docker’s post-installation documentation gives the fix: either delete the .docker folder, which Docker recreates automatically but loses any custom settings inside it, or change its ownership back to your user with these commands:
- Give the folder back to your user:
sudo chown "$USER":"$USER" /home/"$USER"/.docker -R - Fix the permissions on it:
sudo chmod g+rwx "$HOME/.docker" -R - Run docker run hello-world again without sudo to confirm the warning is gone.
Fix the repository errors beginners hit
Almost every failed Docker install on Ubuntu 24.04 fails in the repository setup, not in the install itself. The errors look technical, but each one names the step that went wrong. Work through this table in order, fix the cause, run sudo apt update again, and only then retry the install.
| What apt says | What went wrong | Fix |
|---|---|---|
| Unable to locate package docker-ce | Apt cannot see Docker’s repository, usually because sudo apt update was not run after adding it | Check the file exists with ls /etc/apt/sources.list.d/docker.sources, then run sudo apt update |
| GPG error, signatures could not be verified, or NO_PUBKEY | The signing key is missing, in the wrong place, or unreadable | Check /etc/apt/keyrings/docker.asc exists, run sudo chmod a+r on it, and check the Signed-By line points at that exact path |
| 404 Not Found, or a release file error mentioning noble | The Suites line names the wrong Ubuntu release, often jammy copied from an Ubuntu 22.04 tutorial | Open docker.sources and confirm Suites resolves to noble, matching VERSION_CODENAME=noble in /etc/os-release |
| The repository is not signed, or InRelease is not signed | Apt cannot verify the repository, usually because the key file permissions are wrong or the Signed-By line is missing | Re-run the chmod step on docker.asc and confirm the Signed-By line is present in docker.sources |
| Warning about apt-key being deprecated | You followed an old tutorial that used apt-key add, which Ubuntu no longer supports | Remove the apt-key key and follow the keyrings steps in this guide instead |
Two mistakes are the ones people repeat. The first is editing the source file by hand and introducing a typo in the Signed-By path. The path must be /etc/apt/keyrings/docker.asc, character for character, because apt reads it literally. The second is skipping the chmod a+r step. The key downloads with permissions that keep it private to root, so the repository looks unsigned. Both mistakes produce errors that mention signatures, which sends people searching for key problems when only the permissions are wrong.
If the errors persist, check the two files directly. Run cat /etc/apt/sources.list.d/docker.sources and compare every line with the version in the repository section of this guide, then run ls -l /etc/apt/keyrings/docker.asc and confirm the file exists and is readable by all users.
Keep Docker updated
Docker installed from the official repository updates like any other Ubuntu package, which is the main reason this method is worth the extra setup. Run sudo apt update followed by sudo apt upgrade whenever you update the system, and Docker Engine, the CLI, Buildx, and Compose update together.
If you plan to run containers that use the graphics card, such as machine learning workloads, the host needs the right graphics driver before the container can see the card. Our guide to installing NVIDIA drivers on Ubuntu covers that setup for Ubuntu 24.04. For ordinary containers, nothing else is needed.
To remove Docker later, uninstall the five packages with sudo apt purge docker-ce docker-ce-cli containerd.io docker-buildx-plugin docker-compose-plugin docker-ce-rootless-extras, then delete the docker.sources file and the key from /etc/apt/keyrings. Images and containers in /var/lib/docker are not removed by the uninstall, so delete that folder yourself for a fully clean system.
Docker on Ubuntu 24.04 comes down to one decision and one careful sequence. The decision is the official repository, not the snap, not Ubuntu’s docker.io package, and not the convenience script. The sequence is the signing key, the source file, the update, and the five packages, followed by the hello-world test and the docker group setup. Get those right and Docker stays updated through apt like any other package.
- How to Install Docker on Ubuntu 24.04 (Step-by-Step Guide) - December 3, 2026
- How to Fix Windows Update Error 0x80073712 [Fix] - December 2, 2026
- How to Fix a Keyboard Typing the Wrong Characters on Windows 11 [Fix] - December 1, 2026
