Debian: Setup & Install Docker
Debian: Setup & Install Docker
This is more for my reference than anything else, but here are the steps to install Docker on Ubuntu.
Cleaning up old versions
if we have any old/existing versions of Docker installed, we should remove them first:
1
sudo apt-get purge docker-ce docker-ce-cli containerd.io docker-buildx-plugin docker-compose-plugin docker-ce-rootless-extras
Installing Docker
Now we can install Docker by following these steps:
1
2
3
4
5
6
7
8
9
10
11
12
13
# Add Docker's official GPG key:
sudo apt-get update
sudo apt-get install ca-certificates curl
sudo install -m 0755 -d /etc/apt/keyrings
sudo curl -fsSL https://download.docker.com/linux/debian/gpg -o /etc/apt/keyrings/docker.asc
sudo chmod a+r /etc/apt/keyrings/docker.asc
# Add the repository to Apt sources:
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" | \
sudo tee /etc/apt/sources.list.d/docker.list > /dev/null
sudo apt-get update
If you use a derivative distribution, such as Kali Linux, you may need to substitute the part of this command that’s expected to print the version codename: $(. /etc/os-release && echo “$VERSION_CODENAME”) Replace this part with the codename of the corresponding Debian release, such as bookworm.
Install the latest version of Docker Engine and containerd
1
sudo apt-get install docker-ce docker-ce-cli containerd.io docker-buildx-plugin docker-compose-plugin
Check installed version
1
sudo systemctl status docker
Some versions require you to manually start the Docker service
1
sudo systemctl start docker
Check Docker Compose
1
docker compose
Use Docker without sudo
To avoid using sudo with every Docker command, add your user to the docker group:
1
sudo usermod -aG docker $USER
You’ll need to log out then back in to apply this change.
This post is licensed under CC BY 4.0 by the author.
