Install Docker on Ubuntu/Debian
In this guide, we will install Docker for server and not "Desktop".
Installation with Docker's official repository via apt.
In this guide, we assume you have root access to your server. Therefore, we will not use
sudo in the commands.
Step 1: Update the system
It is recommended to update your system before installing Docker. Execute the following commands:
apt update && apt upgrade -y
Step 2: Remove old versions of Docker
If you have already tried to install Docker, it is best to remove the old versions before proceeding with a new installation. Execute the following command:
for pkg in docker.io docker-doc docker-compose docker-compose-v2 podman-docker containerd runc; do sudo apt-get remove $pkg; done
Step 3
Ubuntu
To add the Docker repository on Ubuntu, execute the following commands:
apt-get update
apt-get install ca-certificates curl
install -m 0755 -d /etc/apt/keyrings
curl -fsSL https://download.docker.com/linux/ubuntu/gpg -o /etc/apt/keyrings/docker.asc
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 "${UBUNTU_CODENAME:-$VERSION_CODENAME}") stable" | \
tee /etc/apt/sources.list.d/docker.list > /dev/null
apt-get update
Debian
To add the Docker repository on Debian, execute the following commands:
apt-get update
apt-get install ca-certificates curl
install -m 0755 -d /etc/apt/keyrings
curl -fsSL https://download.docker.com/linux/debian/gpg -o /etc/apt/keyrings/docker.asc
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/debian \
$(. /etc/os-release && echo "$VERSION_CODENAME") stable" | \
tee /etc/apt/sources.list.d/docker.list > /dev/null
apt-get update
Step 4: Install Docker
Finally, install Docker and its dependencies with the following command:
apt-get install docker-ce docker-ce-cli containerd.io docker-buildx-plugin docker-compose-plugin
Step 5: Verify the installation
To verify that Docker is properly installed, execute the following command:
docker run hello-world
If Docker is installed correctly, you should see a welcome message indicating that Docker is working.
🎉 Congratulations
Docker is now functional on your Ubuntu/Debian server!
If you encounter any issues, open a ticket on our Discord.