How to Install Docker on Ubuntu 20.04
Table of contents
- Key takeaways
- What is Docker and why use it?
- Prerequisites
- Install Docker from the official repository
- Install Docker CE and configure permissions
- Verify the installation
- Frequently asked questions
- Do I need to remove old Docker packages first?
- Does Ubuntu 20.04 still make sense for this?
- What is the difference between docker-ce and docker.io?
- Conclusion
- Sources
Updated: 2026-07-07
Learn how to install Docker on Ubuntu 20.04 from the official repository. Configure the daemon, add your user to the docker group, and verify installation.
Docker[1] is a system that lets you encapsulate applications inside containers: portable software units that include everything needed to run an application in isolation (services, configurations, data and dependencies) without having to adapt the host server. This article explains how to install Docker on Ubuntu 20.04 from the official repository.
Key takeaways
-
Docker containers are lighter than virtual machines because they share the host operating system kernel.
-
The official Ubuntu repository doesn’t always include the latest Docker version: installing from Docker’s own repository ensures the most recent release.
-
Adding your user to the
dockergroup lets you run commands withoutsudo. -
Verify the installation with
docker --versionanddocker run hello-worldto confirm the daemon is active.
What is Docker and why use it?
Docker is the world’s most widely used container platform. Unlike virtual machines, which virtualise the complete hardware stack, Docker containers share the host operating system kernel. This makes them:
-
Faster to start (seconds rather than minutes).
-
Lighter on memory and disk.
-
Easier to move between servers or cloud environments.
-
Reproducible: the same container behaves identically in development, staging and production.
Docker official logo, container engine
Prerequisites
-
A server running Ubuntu 20.04[2].
-
Access to a user with
sudoprivileges.
Install Docker from the official repository
Ubuntu’s package repository doesn’t always offer the latest Docker version. To get the most recent release, install from Docker’s repository. First update the package index and add the necessary dependencies:
sudo apt-get update
sudo apt install apt-transport-https ca-certificates curl software-properties-common
Add Docker’s GPG key to verify package authenticity:
curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo apt-key add -
Register the official Docker repository pointing to the focal stable branch:
sudo add-apt-repository "deb [arch=amd64] https://download.docker.com/linux/ubuntu focal stable"
sudo apt-get update
Install Docker CE and configure permissions
Install Docker Community Edition and add your user to the docker group to run commands without sudo. The su - ${USER} command reloads the session so the group change takes effect:
sudo apt-get install docker-ce
sudo usermod -aG docker ${USER}
su - ${USER}
Ubuntu logo: the same Docker installation flow applies across 20.04 and 22.04 LTS
Verify the installation
Check the installed version and confirm the Docker daemon is running:
docker --version
For a more complete check, run the official test container:
docker run hello-world
If the installation is correct, Docker will pull the hello-world image and display a confirmation message. With Docker installed, the natural next step is to install Docker Compose on Ubuntu 20.04 to manage multi-container applications, or set up Traefik as a reverse proxy to publish services on the internet.
Frequently asked questions
Do I need to remove old Docker packages first?
Yes, if the server already has any installed. Docker’s official guide[3] asks you to uninstall docker.io, docker-compose, docker-compose-v2, docker-doc and podman-docker first, plus containerd and runc if they were installed separately, so they do not conflict with docker-ce.
Does Ubuntu 20.04 still make sense for this?
It depends what you need it for. Standard support for Ubuntu 20.04 (Focal Fossa) ended in April 2025; after that it only gets patches through Extended Security Maintenance (ESM), available until 2030. The steps in this article are the same on Ubuntu 22.04 and 24.04, swapping focal for jammy or noble in the repository step.
What is the difference between docker-ce and docker.io?
docker-ce is the Community edition that Docker Inc. publishes and updates in its own repository, the one this guide installs. docker.io is the package Ubuntu builds and ships in its own repositories, which usually trails several versions behind.
Conclusion
Installing Docker from the official repository always guarantees the most recent, stable version, avoiding stale packages from Ubuntu’s own repository. With the user added to the docker group and the daemon active, the environment is ready to run and orchestrate containers immediately.
Prefer to read it in Spanish? Here is the Spanish version of this article.