Installing Docker on Debian 13 (Trixie)
Step 1: Update the Package Index and Install Dependencies
sudo apt update
sudo apt install ca-certificates curl
Step 2: Import Docker’s Official GPG Key
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
Step 3: Add the Docker APT Repository
echo \
"deb [arch=$(dpkg --print-architecture) signed-by=/etc/apt/keyrings/docker.asc] https://download.docker.com/linux/debian trixie stable" | \
sudo tee /etc/apt/sources.list.d/docker.list
Step 4: Install Docker Engine
sudo apt update
sudo apt install docker-ce docker-ce-cli containerd.io docker-buildx-plugin docker-compose-plugin
Verify the Docker Installation
sudo systemctl status docker
The output will look something like this:
● docker.service - Docker Application Container Engine
Loaded: loaded (/usr/lib/systemd/system/docker.service; enabled)
Active: active (running)
...
Run Docker Commands Without sudo
By default, only root and users with sudo privileges can run Docker commands.
To allow a non-root user to execute Docker commands, add the user to the docker group:
sudo usermod -aG docker $USER
$USER is an environment variable that holds the currently logged-in username. To add a different user, replace $USER with the username.
Run newgrp docker or log out and log back in for the group membership change to take effect.
Verifying Docker with a Test Container
To verify that Docker is installed correctly and works without sudo , run a test container :
docker container run hello-world
If the image is not found locally, Docker will download it from Docker Hub, run the container, print a “Hello from Docker” message, and exit.
Unable to find image 'hello-world:latest' locally
latest: Pulling from library/hello-world
...
Hello from Docker!
This message shows that your installation appears to be working correctly.
...
The container stops after printing the message because it has no long-running process.