Docker has become one of the most important tools in modern software development. If you want to Install Docker on Ubuntu systems for containerized applications, setting it up correctly from the official repository is the safest approach. Docker allows developers to build, test, and deploy applications in isolated environments called containers, making deployments faster and more consistent.
Unlike traditional virtual machines, Docker containers use fewer system resources and start almost instantly. As a result, developers, DevOps teams, and cloud engineers rely on Docker for everything from local testing to production deployments.
Ubuntu includes Docker packages in its default repositories. However, those versions are sometimes outdated. Therefore, installing Docker from Docker’s official repository ensures you receive the latest features, bug fixes, and security updates.
Before starting, make sure your system meets these requirements:
It is also recommended to remove any old Docker-related packages before proceeding.
sudo apt remove docker.io docker-doc docker-compose podman-docker containerd runc
First, update your package list and install the required dependencies.
sudo apt updatesudo apt install ca-certificates curl
Next, create the Docker keyring directory and download Docker’s official GPG key.
sudo install -m 0755 -d /etc/apt/keyringssudo curl -fsSL https://download.docker.com/linux/ubuntu/gpg -o /etc/apt/keyrings/docker.ascsudo chmod a+r /etc/apt/keyrings/docker.asc
After that, add Docker’s official repository to Ubuntu.
sudo tee /etc/apt/sources.list.d/docker.sources <<EOFTypes: debURIs: https://download.docker.com/linux/ubuntuSuites: $(. /etc/os-release && echo "${UBUNTU_CODENAME:-$VERSION_CODENAME}")Components: stableArchitectures: $(dpkg --print-architecture)Signed-By: /etc/apt/keyrings/docker.ascEOF
Now refresh the package database and install Docker Engine.
sudo apt updatesudo apt install docker-ce docker-ce-cli containerd.io docker-buildx-plugin docker-compose-plugin
Once installation finishes, check whether Docker is running properly.
sudo systemctl status docker
You can also verify the installed Docker version.
sudo docker version
To confirm Docker can download and run containers successfully, execute the test container below.
sudo docker run hello-world
If everything works correctly, Docker will pull the test image and display a confirmation message.
By default, Docker commands require sudo access. Fortunately, Ubuntu lets you grant Docker permissions to your user account.
sudo usermod -aG docker $USER
Then apply the new group changes:
newgrp docker
Afterward, test Docker again without sudo.
docker run hello-world
Keeping Docker updated is important for security and performance.
Update Docker packages:
sudo apt updatesudo apt upgrade
Remove unused Docker resources:
docker system prune -a
Uninstall Docker completely if needed:
sudo apt purge docker-ce docker-ce-cli containerd.io
Choosing to Install Docker on Ubuntu systems from the official Docker repository gives you access to the latest stable releases and security improvements. In addition, Docker simplifies application deployment, improves development workflows, and supports modern DevOps practices. Once Docker is installed correctly, you can start building containers, deploying services, and managing scalable applications with ease.