How to Install Docker on Ubuntu 24.04: Step-by-Step Guide
Docker packages applications and their dependencies into lightweight containers that run consistently across environments. Installing Docker on Ubuntu 24.04 gives you access to Docker Engine, Docker CLI, BuildKit, and Docker Compose V2, all from a single installation.
This guide walks you through the full process: adding Docker's official APT repository, installing Docker Engine (Community Edition), configuring non-root access, and verifying the setup. You will also learn essential commands for managing Docker images and containers.
#What is Docker?
Docker is an open-source containerization platform that lets you build, share, deploy, and orchestrate applications anywhere, whether on Linux, Windows, Mac, or any other computing environment.
Written in the Go programming language, Docker uses OS-level virtualization to package applications inside containers. Containers are isolated environments that package everything an application needs to run: source code, binaries, dependencies, libraries, etc. Docker containers ensure that applications run reliably, even when ported from one computing environment to another.
#Prerequisites
To follow along, ensure you have the following requirements in place:
-
An instance of Ubuntu 24.04 with SSH access
-
A
sudouser configured on the server instance -
A stable internet connection (Docker packages are downloaded from external repositories)
-
At least 2 GB of free disk space for Docker Engine and initial images
Ready to supercharge your Docker infrastructure? Scale effortlessly and enjoy flexible storage with Cherry Servers bare metal or virtual servers. Eliminate infrastructure headaches with free 24/7 technical support, pay-as-you-go pricing, and global availability.
#How to install Docker on Ubuntu 24.04?
https://youtu.be/IK37cvvx7yE?si=IzHeI8nTOdW-rtdw
Follow the steps below to install Docker on Ubuntu 24.04.
#Step 1. Update the system and install dependencies
Log in to your server and update the local package index. This ensures your system has the latest package metadata before adding new repositories.
sudo apt update
Install the packages needed to add and verify external repositories over HTTPS:
sudo apt install ca-certificates curl gnupg lsb-release -y
#Step 2. Install Docker
There are two ways to install Docker on Ubuntu. First, you can install it from the default repositories using the APT package manager.
sudo apt install docker.io -y
However, the version installed is not the latest. To install the most current version, you need to install it from the official Docker repository.
First, create the keyrings directory and download Docker's official GPG key:
sudo install -m 0755 -d /etc/apt/keyrings
curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo gpg --dearmor -o /etc/apt/keyrings/docker.gpg
sudo chmod a+r /etc/apt/keyrings/docker.gpg
The install -m 0755 -d command creates the /etc/apt/keyrings directory with the correct permissions. The GPG key allows APT to verify the authenticity of packages from Docker's repository.
Next, add the Docker APT repository to your system. The command creates a docker.list repository file in the /etc/apt/sources.list.d directory.
echo "deb [arch=$(dpkg --print-architecture) signed-by=/etc/apt/keyrings/docker.gpg] https://download.docker.com/linux/ubuntu $(lsb_release -cs) stable" | sudo tee /etc/apt/sources.list.d/docker.list > /dev/null
Next, update the local package index to notify the system of the newly added repository.
sudo apt update
Now install Docker Engine along with its companion tools. The command below installs the Docker daemon, CLI client, container runtime, BuildKit plugin, and Docker Compose V2 plugin:
sudo apt install docker-ce docker-ce-cli containerd.io docker-buildx-plugin docker-compose-plugin -y
Here is what each package does:
-
docker-ce: the Docker Engine daemon -
docker-ce-cli: the command-line interface for interacting with Docker -
containerd.io: the container runtime that manages container lifecycles -
docker-buildx-plugin: extendsdocker buildwith BuildKit features like multi-platform builds -
docker-compose-plugin: integrates Docker Compose V2 into the Docker CLI asdocker compose
Important: If you only install docker-ce, you will be missing the CLI tools, Compose, and BuildKit. Always install the full set of packages listed above.
The Docker service starts automatically upon installation. You can verify its status by running the command:
sudo systemctl status docker
The output below is confirmation that Docker is running as expected.
Output● docker.service - Docker Application Container Engine
Loaded: loaded (/usr/lib/systemd/system/docker.service; enabled; preset: enabled)
Active: active (running) since Tue 2026-02-24 06:21:03 EET; 3s ago
TriggeredBy: ● docker.socket
Docs: https://docs.docker.com
Main PID: 4669 (dockerd)
Tasks: 8
Memory: 42.2M (peak: 42.3M)
CPU: 420ms
CGroup: /system.slice/docker.service
└─4669 /usr/bin/dockerd -H fd:// --containerd=/run/containerd/containerd.sock
If Docker is not running yet, run the following command:
sudo systemctl start docker
You can also confirm the installed Docker version:
docker --version
As of this writing, the latest Docker CE version for Ubuntu 24.04 (noble) is 28.x or 29.x, depending on when you run the installation.
#Step 3. Add user to Docker group
By default, Docker is set to run as root or a regular user with elevated privileges (sudo user). The implication is that only the root or sudo user can run Docker commands. Running Docker commands as a regular user will result in a 'permissions error' message.
Since we already have a sudo user called cherry configured, running Docker as this user is just fine. An even better option is to add the currently logged-in user, in this case, cherry to the docker group. This ensures that we don't have to invoke sudo whenever running Docker commands since the user already belongs to the docker group.
To add the currently logged-in user, use the usermod command.
sudo usermod -aG docker $USER
Next, activate the new group membership in your current session:
newgrp docker
Note: The newgrp command requires the group name as an argument. Running newgrp without specifying docker switches to your primary group instead, which does not grant Docker access.
Now run the groups command to verify that the user has been added to the docker group.
groups [user]
To start running Docker commands without invoking sudo, close and start a new shell session. Alternatively, you can run the following command without closing your current session:
su - $USER
Moving forward, you can run Docker commands as a regular user. For example, you can check the version of Docker by running:
docker version
OutputClient: Docker Engine - Community
Version: 29.2.1
API version: 1.53
Go version: go1.25.6
Git commit: a5c7197
Built: Mon Feb 2 17:17:26 2026
OS/Arch: linux/amd64
Context: default
Server: Docker Engine - Community
Engine:
Version: 29.2.1
API version: 1.53 (minimum version 1.44)
Go version: go1.25.6
Git commit: 6bc6209
Built: Mon Feb 2 17:17:26 2026
OS/Arch: linux/amd64
Experimental: false
containerd:
Version: v2.2.1
GitCommit: dea7da592f5d1d2b7755e3a161be07f43fad8f75
runc:
Version: 1.3.4
GitCommit: v1.3.4-0-gd6d73eb8
docker-init:
Version: 0.19.0
GitCommit: de40ad0
#Step 4. Test Docker installation
Up to this point, Docker has been successfully installed. Before proceeding further, you must ensure that you can pull images and run containers from Docker Hub, the default Docker registry configured to run with Docker. To test this, we will create a container from the hello-world image.
docker run hello-world
You will get the following output on your screen:
OutputUnable to find image 'hello-world:latest' locally
latest: Pulling from library/hello-world
17eec7bbc9d7: Pull complete
Digest: sha256:ef54e839ef541993b4e87f25e752f7cf4238fa55f017957c2eb44077083d7a6a
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/
So what exactly happened?
In the background, the Docker client searched for an image called hello-world with a tag latest on the local system but could not find it. It then contacted Docker Hub, pulled the image to the local system, and created a new container from that image. The container then streams the output on your terminal and exits.
The output displayed confirms that Docker is working as expected.
#Step 5. How to run Docker commands
The Docker CLI uses the following syntax:
docker [OPTIONS] command
To get a list of common Docker commands, run the docker command without any options.
docker
#Step 6. Working with Docker images
A Docker image is essentially a file containing instructions to build a container. Docker is configured to use Docker Hub, an online registry for Docker images. You can search Docker images by running the docker search command followed by the image name.
For example, to search for the Nginx image on the Docker hub, run the command:
docker search nginx
OutputNAME DESCRIPTION STARS OFFICIAL
nginx Official build of Nginx. 21191 [OK]
nginx/nginx-ingress NGINX and NGINX Plus Ingress Controllers fo... 114
nginx/nginx-prometheus-exporter NGINX Prometheus Exporter for NGINX and NGIN... 50
nginx/unit This repository is retired, use the Docker o... 66
nginx/nginx-ingress-operator NGINX Ingress Operator for NGINX and NGINX P... 3
nginx/nginx-quic-qns NGINX QUIC interop 1
nginx/nginxaas-loadbalancer-kubernetes 1
nginx/unit-preview Unit preview features 0
bitnami/nginx Bitnami Secure Image for nginx 203
bitnamicharts/nginx Bitnami Helm chart for NGINX Open Source 3
ubuntu/nginx Nginx, a high-performance reverse proxy & we... 139
kasmweb/nginx An Nginx image based off nginx:alpine and in... 8
rancher/nginx 3
linuxserver/nginx An Nginx container, brought to you by LinuxS... 236
dtagdevsec/nginx T-Pot Nginx 0
vmware/nginx 3
paketobuildpacks/nginx 0
chainguard/nginx Build, ship and run secure software with Cha... 5
gluufederation/nginx A customized NGINX image containing a consu... 1
cleanstart/nginx Secure by Design, Built for Speed, Hardened ... 0
antrea/nginx Nginx server used for Antrea e2e testing 0
intel/nginx 0
circleci/nginx This image is for internal use 2
corpusops/nginx https://github.com/corpusops/docker-images/ 1
activestate/nginx ActiveState's customizable, low-to-no vulner... 0
Docker will sift through the Docker registry and generate a list of images matching the image you are searching for. In the Official column, the Ok flag indicates that the image has been developed by the official vendor behind the project, in this case, Nginx.
To download or pull the image, run the docker pull command:
docker pull nginx
OutputUsing default tag: latest
latest: Pulling from library/nginx
0c8d55a45c0d: Pull complete
46bf3a120c8e: Pull complete
4f4efe02d542: Pull complete
7b6cb8ccac7b: Pull complete
f73400a233fd: Pull complete
47cd406a84ef: Pull complete
bae5a1799a80: Pull complete
Digest: sha256:341bf0f3ce6c5277d6002cf6e1fb0319fa4252add24ab6a0e262e0056d313208
Status: Downloaded newer image for nginx:latest
docker.io/library/nginx:latest
To list existing Docker images, run:
docker images
The output includes the image name, image ID, disk usage, and size.
OutputIMAGE ID DISK USAGE CONTENT SIZE EXTRA
hello-world:latest 1b44b5a3e06a 10.1kB 0B U
nginx:latest 5cdef4ac3335 161MB 0B
Also read: How to install Wine on Ubuntu 24.04
#Step 7. Working with Docker Containers
The docker run command creates a container from an image. When the image is locally available on your system, the container is created right away, and its container ID is printed on the console. If the image is unavailable, Docker pulls it from the Docker Hub registry and creates the container. To demonstrate how to work with containers, we will create an Nginx container, as shown.
docker run -d -p 8080:80 nginx
The -d option runs the container in detached mode (in the background) while the -p option maps port 80 on the container to port 8080 on your Docker host.
To confirm that the web server is running, launch your web browser and visit the URL:
http://server-ip:8080
You will see the Nginx welcome page displayed below.
You can view currently running containers on the terminal using the docker ps command.
docker ps
OutputCONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
843c308a94e9 nginx "/docker-entrypoint...." 4 minutes ago Up 4 minutes 0.0.0.0:8080->80/tcp, [::]:8080->80/tcp hopeful_bell
To list all containers, including those that exited, pass the -a option
docker ps -a
From the output, you can see two containers: the nginx container, which is currently running, and the hello-world container.
OutputCONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
843c308a94e9 nginx "/docker-entrypoint...." 4 minutes ago Up 4 minutes 0.0.0.0:8080->80/tcp, [::]:8080->80/tcp hopeful_bell
6bceb8ce3f4c hello-world "/hello" 9 minutes ago Exited (0) 9 minutes ago nice_mahavira
To stop a running container, issue the docker stop command followed by the container ID as shown.
docker stop 843c308a94e9
Alternatively, you can use the arbitrary container name assigned to the container to stop it. In this case, the container name is hopeful_bell. So the command would look like:
docker stop hopeful_bell
To remove a container, stop it first, then run the docker rm command followed by the container ID.
docker rm 843c308a94e9
To remove an image, run the docker rmi [image name or ID] command followed by the image name. But first, you need to remove the container associated with the image before removing the image. Otherwise, you'll encounter a conflict error.
Therefore, be sure to remove the container associated with the image by stopping it and removing it.
docker stop 843c308a94e9 && docker rm 843c308a94e9
You can now remove the image using the docker rmi command followed by the image ID or name.
docker rmi nginx
OutputUntagged: nginx:latest
Untagged: nginx@sha256:341bf0f3ce6c5277d6002cf6e1fb0319fa4252add24ab6a0e262e0056d313208
Deleted: sha256:5cdef4ac3335f68428701c14c5f12992f5e3669ce8ab7309257d263eb7a856b1
Deleted: sha256:13553ab839fc3f04eb110571316ce86c00dc9a7dbd6e0960e577c7d0e94edb37
Deleted: sha256:3438c08a37f122b1e2a7a0024fefe5d904c718a3dfae622d1bded1a6cd05b6f5
Deleted: sha256:265d115060dd452fd6bd76b13090beeb7cbd4545bc82ebd13070f8b5b8b99b3c
Deleted: sha256:de7ade74c1354e037452e80fb7198b5aa8b15ccb70d74b4272506a00e03bda02
Deleted: sha256:a40fa7f04e226ed78d693059f0223c621bc9202a95f4926a9e18ed400ca57242
Deleted: sha256:03e9a4dc9545f6a615ed07637b5e51764b6349089cb74e72e37a60d8aef4009b
Deleted: sha256:a8ff6f8cbdfd6741c10dd183560df7212db666db046768b0f05bbc3904515f03
#How to verify Docker Compose installation
Since you installed the docker-compose-plugin package in Step 2, Docker Compose V2 is already available as a subcommand of the Docker CLI. Verify it with:
docker compose version
You should see output like Docker Compose version v2.x.x.
Docker Compose V2 replaces the older standalone docker-compose (hyphenated) tool, which reached end of life in July 2023. The new version uses docker compose (with a space) and ships as a CLI plugin. All Compose functionality works the same way, but the command syntax has changed.
For a complete guide to Compose commands, see our Docker Compose cheat sheet.
#Conclusion
You have installed Docker Engine on Ubuntu 24.04 from the official repository, configured non-root access, and learned the essential commands for managing images and containers. Docker Compose V2 is also ready to use for multi-container applications.
FAQs
How do I install a specific Docker version on Ubuntu 24.04?
List all available versions with `apt list --all-versions docker-ce`, then install a specific one by passing the version string: `sudo apt install docker-ce=5:29.2.1-1~ubuntu.24.04~noble`. Match the `docker-ce-cli` version to the same string.
Is `docker.io` the same as `docker-ce`?
No. `docker.io` is the Docker package maintained by Ubuntu's repositories. It often lags behind the latest release. `docker-ce` comes from Docker's official repository and includes the newest features and security patches. For production use, install `docker-ce`.
Can I run Docker on Ubuntu 24.04 ARM64?
Yes. Docker's official repository provides ARM64 (`aarch64`) packages for Ubuntu 24.04. The installation steps are identical. The `dpkg --print-architecture` command in the repository setup automatically detects your architecture.
How do I update Docker to the latest version?
Run `sudo apt update && sudo apt upgrade docker-ce docker-ce-cli containerd.io docker-buildx-plugin docker-compose-plugin`. APT pulls the latest version from Docker's repository. Running containers are not affected until you restart them.
Does installing Docker on Ubuntu require a reboot?
No. Docker starts immediately after installation. The only time you need to log out and back in is after adding your user to the `docker` group, so the new group membership takes effect.
What is the difference between Docker Engine and Docker Desktop?
Docker Engine is the server-side daemon and CLI that runs containers on Linux. Docker Desktop is a GUI application for Mac, Windows, and Linux that bundles the Docker Engine, Kubernetes, a dashboard, and additional developer tools. For servers, Docker Engine is the standard choice.
Starting at just $3.24 / month, get virtual servers with top-tier performance.
