Docker Engine allows you to build, run, and manage containerised applications. This guide installs the latest Docker Engine (25.x) on Ubuntu 24.04 LTS using the official Docker repository.
Tested and valid on:
- Ubuntu 24.04 LTS
Prerequisites
- Ubuntu 24.04 LTS server
- A user with sudo privileges
Step 1 – Remove Old Docker Versions
Remove any unofficial Docker packages:
for pkg in docker.io docker-doc docker-compose docker-compose-v2 podman-docker containerd runc; do sudo apt-get remove $pkg; done
Step 2 – Add Docker’s Official GPG Key and Repository
Install prerequisites and add the Docker repo:
sudo apt update
sudo apt install ca-certificates curl -y
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
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
Step 3 – Install Docker Engine
Update and install Docker packages:
sudo apt update
sudo apt install docker-ce docker-ce-cli containerd.io docker-buildx-plugin docker-compose-plugin -y
Step 4 – Verify the Installation
Run the hello-world test container:
sudo docker run hello-world
Step 5 – Manage Docker as a Non-Root User
Add your user to the docker group:
sudo usermod -aG docker $USER
Log out and back in for the change to take effect. Then test:
docker run hello-world
Step 6 – Start Docker on Boot
Enable Docker and containerd:
sudo systemctl enable docker.service
sudo systemctl enable containerd.service
Step 7 – Check the Version
Verify Docker Engine version:
docker --version
docker compose version
Conclusion
Docker Engine is now installed on Ubuntu 24.04 LTS. You can pull images from Docker Hub, build custom images with Dockerfiles, and orchestrate multi-container applications with Docker Compose.