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.
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.
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.
Add your user to the docker group so you don’t need sudo all the time.
usermod -aG docker $USER
newgrp docker
You don’t need to memorize 100 commands. There are like… 6 or 7 that you will use all the time.
docker ps
docker ps -a
docker start <container>
docker stop <container>
docker restart <container>
docker logs <container>
docker logs -f <container>
docker exec -it <container> bash
docker build -t myapp .
docker run -d -p 5000:5000 myapp
If you’re running more than one container… just use docker compose. Seriously.
docker compose up -d
docker compose down
docker compose up -d --build
If you change your code and nothing happens… you probably forgot --build. Happens all the time.
This is where most people get stuck. Docker itself is usually fine… your container is not.
docker compose logs
docker compose logs -f
docker compose logs flask
docker ps -a
docker inspect <container>
docker compose up
If your container instantly exits, don’t restart it 10 times. Check logs first. It’s almost always in there.
Fast deployments, clean environments, reproducible setups.
Debugging at the beginning, networking confusion, forgetting rebuilds.
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.