guides

Docker on Debian 12 – how I set it up and the commands I actually use

Docker on Debian 12 is honestly one of the cleanest setups you can have. This is how I usually install it, get it running, and the commands I keep using over and over again when something breaks (because it will).
Docker on Debian 12 – how I set it up and the commands I actually use
2026-04-08
Getting Docker running on Debian

I’ve set up Docker on Debian more times than I can count at this point. And honestly… once you know the steps, it’s always the same thing.

Debian 12 is a really solid base for it. Stable, predictable, no weird surprises. Exactly what you want when you're running containers.

Installation (the way I actually do it)

You can install Docker from Debian repos… but don’t. It’s usually outdated. Just use the official Docker repo and be done with it.

Install Docker (official way)
apt update
apt install ca-certificates curl gnupg

install -m 0755 -d /etc/apt/keyrings
curl -fsSL https://download.docker.com/linux/debian/gpg | gpg --dearmor -o /etc/apt/keyrings/docker.gpg

echo \
  "deb [arch=$(dpkg --print-architecture) signed-by=/etc/apt/keyrings/docker.gpg] https://download.docker.com/linux/debian \
  bookworm stable" > /etc/apt/sources.list.d/docker.list

apt update
apt install docker-ce docker-ce-cli containerd.io docker-buildx-plugin docker-compose-plugin

After that, Docker is basically ready.

Tip

Add your user to the docker group so you don’t need sudo all the time.

Run Docker without sudo
usermod -aG docker $USER
newgrp docker
Basic commands I actually use

You don’t need to memorize 100 commands. There are like… 6 or 7 that you will use all the time.

List running containers
docker ps
List all containers (even stopped)
docker ps -a
Start / stop / restart
docker start <container>
docker stop <container>
docker restart <container>
See logs (very important)
docker logs <container>
docker logs -f <container>
Get inside a container
docker exec -it <container> bash
Build & run (simple example)
docker build -t myapp .
docker run -d -p 5000:5000 myapp
Docker Compose (just use it)

If you’re running more than one container… just use docker compose. Seriously.

Start everything
docker compose up -d
Stop everything
docker compose down
Rebuild after changes
docker compose up -d --build
Note

If you change your code and nothing happens… you probably forgot --build. Happens all the time.

Debugging (the stuff you actually need)

This is where most people get stuck. Docker itself is usually fine… your container is not.

Check logs first (always)
docker compose logs
docker compose logs -f
Logs of one service
docker compose logs flask
Check container status
docker ps -a
Inspect container
docker inspect <container>
Follow logs while restarting
docker compose up
Warning

If your container instantly exits, don’t restart it 10 times. Check logs first. It’s almost always in there.

Good for

Fast deployments, clean environments, reproducible setups.

Annoying parts

Debugging at the beginning, networking confusion, forgetting rebuilds.

Final thoughts

That’s basically it.

You don’t need to know everything about Docker. Just get it running, understand logs, and know how to restart stuff.

Everything else you’ll figure out along the way anyway.