How to install Docker on Ubuntu 22.04 (Jammy) or 24.04 (Noble): remove old versions, add Docker’s official apt repo, install docker-ce. Post-install for non-root user. The team that follows this guide has the current Docker version on Ubuntu in under 5 minutes.
Table of contents
- Remove old Docker
- Add Docker’s apt repo
- Install Docker
- Verify
- Post-install: non-root user
- Start docker at boot
- FAQ
Remove old Docker
sudo apt remove docker docker-engine docker.io containerd runc
If nothing’s installed, this errors harmlessly. The team that skips this step on a machine with old docker.io has version conflicts.
Add Docker’s apt repo
sudo apt update
sudo apt install ca-certificates curl
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 > /dev/null
sudo apt update
Install Docker
sudo apt install docker-ce docker-ce-cli containerd.io docker-buildx-plugin docker-compose-plugin
Verify
sudo docker run hello-world
The team that sees ‘Hello from Docker!’ has working install.
Post-install: non-root user
sudo usermod -aG docker $USER
newgrp docker
docker run hello-world # no sudo
Start docker at boot
sudo systemctl enable --now docker
The team that enables the service has docker start on boot.
FAQ
Do I need to uninstall Ubuntu’s docker.io first?
Recommended - otherwise you have version conflicts. The team that has both has ‘docker’ command from docker.io and ‘docker-ce’ from Docker’s repo, with different behavior.
Can I install Docker on Ubuntu 20.04?
Yes, but Docker’s support for 20.04 is ending. The team that uses 22.04 or 24.04 LTS has long-term support.
Do I need Docker Desktop?
No - Docker Desktop is for Mac/Windows. On Linux, Docker Engine is the right product. The team that runs Linux servers has no Desktop needed.
What about WSL2?
Docker Desktop’s WSL2 backend is the easiest path on Windows. The team that uses WSL2 without Docker Desktop installs Docker Engine inside the WSL2 distro.
How do I check Docker version after install?
docker version shows client and server versions. docker info shows full daemon config.
If you are sizing the infrastructure for the kind of project this post covers, the RunxBuild hosting calculator is the right place to model the line items. The compute, the memory, the storage, the bandwidth, the database - each one is a separate number, and the team’s mental model for the platform is the sum of those numbers. The RunxBuild dashboard is where the team sees the actual usage in one place.
Useful related references: