Operations 5 min read

How to Install Docker on Ubuntu 24.04

This guide walks you through updating Ubuntu 24.04, adding Docker's repository, installing the Docker engine, starting and enabling the service, verifying the installation, adding your user to the Docker group, and running basic Docker commands, all with exact terminal commands.

DevOps Operations Practice
DevOps Operations Practice
DevOps Operations Practice
How to Install Docker on Ubuntu 24.04

In this tutorial you will learn how to install Docker on Ubuntu 24.04, from system update to running your first container.

Step 1: Update the system

Before installing Docker, update the package list and upgrade existing packages.

sudo apt update
sudo apt upgrade

Step 2: Install Docker

Add Docker's repository and install required packages.

Install prerequisite packages: sudo apt install apt-transport-https ca-certificates curl software-properties-common

Import Docker’s GPG key: curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo gpg --dearmor -o /usr/share/keyrings/docker-archive-keyring.gpg

Add the Docker APT repository: echo "deb [arch=amd64 signed-by=/usr/share/keyrings/docker-archive-keyring.gpg] https://download.docker.com/linux/ubuntu $(lsb_release -cs) stable" | sudo tee /etc/apt/sources.list.d/docker.list > /dev/null

Refresh the package index: sudo apt update

Install Docker Engine: sudo apt install docker-ce container.io

Step 3: Start and enable Docker

Start the Docker service and configure it to start on boot.

sudo systemctl start docker
sudo systemctl enable docker

Step 4: Verify the installation

Check that Docker is installed correctly.

sudo docker --version

Step 5: Add your user to the Docker group

Allow running Docker commands without sudo.

sudo usermod -aG docker $USER

Apply the new group membership:

newgroup docker

Step 6: Run your first Docker container

Test the installation with a simple container.

docker run hello-world

Common Docker commands

List images: sudo docker images

List running containers: sudo docker ps

List all containers: sudo docker ps -a

Stop a container: sudo docker stop CONTAINER_ID

Remove a container: sudo docker rm CONTAINER_ID

Remove an image: sudo docker rmi IMAGE_ID

Conclusion

Congratulations! You have successfully installed Docker on Ubuntu 24.04 and run your first container. Docker simplifies application deployment and management; continue exploring its commands and ecosystem to become proficient.

DockerLinuxcontainerInstallationubuntu
DevOps Operations Practice
Written by

DevOps Operations Practice

We share professional insights on cloud-native, DevOps & operations, Kubernetes, observability & monitoring, and Linux systems.

0 followers
Reader feedback

How this landed with the community

login Sign in to like

Rate this article

Was this worth your time?

Sign in to rate
Discussion

0 Comments

Thoughtful readers leave field notes, pushback, and hard-won operational detail here.