How to Install Docker on Ubuntu 20.04
Actualizado: 2026-05-03
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.
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-commonAdd 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 updateInstall 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}Verify the installation
Check the installed version and confirm the Docker daemon is running:
docker --versionFor a more complete check, run the official test container:
docker run hello-worldIf 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.
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.