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.
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 upgradeStep 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 dockerStep 4: Verify the installation
Check that Docker is installed correctly.
sudo docker --versionStep 5: Add your user to the Docker group
Allow running Docker commands without sudo.
sudo usermod -aG docker $USERApply the new group membership:
newgroup dockerStep 6: Run your first Docker container
Test the installation with a simple container.
docker run hello-worldCommon 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.
DevOps Operations Practice
We share professional insights on cloud-native, DevOps & operations, Kubernetes, observability & monitoring, and Linux systems.
How this landed with the community
Was this worth your time?
0 Comments
Thoughtful readers leave field notes, pushback, and hard-won operational detail here.