The Docker Engine allows you to build, run, and manage containers on Ubuntu. Below is a detailed, knowledge base–ready guide that walks you through installation, configuration, and verification of Docker’s functionality.
sudo privileges.If you have older Docker packages installed (docker, docker.io, containerd, or runc), remove them first:
sudo apt remove docker docker-engine docker.io containerd runc
This will not remove existing images, containers, volumes, or configuration files.
Add Docker’s official repository to your system to ensure you install the latest version of Docker Engine.
sudo apt update sudo apt install -y ca-certificates curl gnupg lsb-release
sudo install -m 0755 -d /etc/apt/keyrings curl -fsSL https://download.docker.com/linux/ubuntu/gpg \ | sudo gpg --dearmor -o /etc/apt/keyrings/docker.gpg sudo chmod a+r /etc/apt/keyrings/docker.gpg
echo \ "deb [arch=$(dpkg --print-architecture) signed-by=/etc/apt/keyrings/docker.gpg] \ https://download.docker.com/linux/ubuntu \ $(lsb_release -cs) stable" \ | sudo tee /etc/apt/sources.list.d/docker.list > /dev/null
sudo apt update
You can verify that the Docker packages come from the official repository:
apt-cache policy docker-ce | sed -n '1,6p'
Install Docker Engine along with the CLI, containerd, Buildx, and Compose plugin:
sudo apt install -y docker-ce docker-ce-cli containerd.io \ docker-buildx-plugin docker-compose-plugin
To see which versions are available before installing:
apt-cache madison docker-ce
To install a specific version, use the <VERSION_STRING> from the previous command:
sudo apt install docker-ce=<VERSION_STRING> docker-ce-cli=<VERSION_STRING> \ containerd.io docker-buildx-plugin docker-compose-plugin
Check that the Docker service is active and running:
sudo systemctl status docker
Then run a test container to confirm everything works:
sudo docker run --rm hello-world
If you see the message “Hello from Docker!”, your installation was successful.
By default, Docker commands require sudo. To run them as your regular user, add yourself to the docker group and log out/in again:
sudo usermod -aG docker $USER # Log out and back in, then run: docker ps
If the command runs successfully without sudo, the change has been applied correctly.
Ensure Docker starts automatically at system boot:
sudo systemctl enable docker
Basic service management commands:
sudo systemctl start docker sudo systemctl stop docker sudo systemctl restart docker sudo systemctl status docker
Quick checks for version and system info:
docker --version docker info
sudo apt update sudo apt -y upgrade docker-ce docker-ce-cli containerd.io \ docker-buildx-plugin docker-compose-plugin
sudo apt -y purge docker-ce docker-ce-cli containerd.io \ docker-buildx-plugin docker-compose-plugin sudo rm -rf /var/lib/docker sudo rm -rf /var/lib/containerd
Deleting /var/lib/docker and /var/lib/containerd removes all containers, images, and volumes.
usermod -aG docker $USER and log out/in.systemctl status docker).sudo apt remove docker.io) and confirm you’re using the official Docker repository.You have successfully installed Docker Engine on Ubuntu. You can now create and manage containers, use the Docker Compose plugin, and automate your development and deployment workflows with confidence.
Contact our experts, they will be happy to help!
Contact us