Debian 13 is a solid base for self-hosting, but Docker installs can get messy faster than people expect. Old distro packages, copied commands from random blog posts, and leftover container tools all have a way of piling up on the same server. Starting from Docker's own repository keeps the setup predictable.
I am using a fresh Debian 13 server here. You will install Docker Engine from Docker's official Debian repository, make sure the daemon is running, test it with hello-world, and optionally set your user up so you do not need sudo for every Docker command.
Minimum and recommended server size
Docker itself is not heavy, but the apps you run on top of it can be.
Minimum for this walkthrough
- 1 vCPU
- 1 GB RAM
- 10 GB free disk space
Recommended for a useful self-hosting base
- 2 vCPU
- 2 GB RAM
- 20 GB or more of free disk space
Docker itself is fairly light. The extra headroom matters once you start adding real services, logs, volumes, and the usual "I will just test one more container" decisions.
What this guide covers
This walkthrough is for Debian 13 (Trixie). Docker also supports Debian 12 and Debian 11, but the commands and examples here are written for Debian 13.
By the end, you will have:
- Docker Engine installed from the official Docker repository
- the Docker service running at boot
- Docker Compose available as a plugin
- one successful test container run
If you are brand new to Docker Compose too, pair this with Docker Compose for Self-Hosted Apps: A Beginner-Friendly Guide once Docker itself is working.
One warning before you start
When Docker publishes container ports, those ports can bypass ufw or firewalld rules unless you account for Docker's networking behavior properly. If you rely on firewall rules heavily, plan to manage Docker-related filtering with iptables or ip6tables and the DOCKER-USER chain.
That does not make Docker a bad idea. It just means you should treat published ports like an actual exposure, not a harmless default.
Step 1: Remove old or conflicting packages
If this server has seen earlier Docker experiments, clear the unofficial packages out first.
sudo apt remove docker.io docker-compose docker-compose-v2 docker-doc podman-docker containerd runc
If nothing is installed yet, apt may simply tell you there is nothing to remove. That is fine.
Step 2: Refresh the package index
sudo apt update
Step 3: Install the packages needed for Docker's repository
sudo apt install ca-certificates curl
Step 4: Create the apt keyring directory
sudo install -m 0755 -d /etc/apt/keyrings
Step 5: Download Docker's GPG key
sudo curl -fsSL https://download.docker.com/linux/debian/gpg -o /etc/apt/keyrings/docker.asc
Step 6: Make the key readable by apt
sudo chmod a+r /etc/apt/keyrings/docker.asc
Step 7: Add Docker's official Debian repository
sudo tee /etc/apt/sources.list.d/docker.sources <<EOF
Types: deb
URIs: https://download.docker.com/linux/debian
Suites: $(. /etc/os-release && echo "${VERSION_CODENAME}")
Components: stable
Architectures: $(dpkg --print-architecture)
Signed-By: /etc/apt/keyrings/docker.asc
EOF
This tells Debian to pull Docker packages from Docker's own repository for your release codename and CPU architecture.
Step 8: Refresh apt again
sudo apt update
If this step works cleanly, Debian can read the Docker repository and trust its signing key.
Step 9: Install Docker Engine and the standard plugins
sudo apt install docker-ce docker-ce-cli containerd.io docker-buildx-plugin docker-compose-plugin
That installs the Docker daemon, the CLI, containerd, the Buildx plugin, and the Docker Compose plugin.
Step 10: Check whether the Docker service is running
sudo systemctl status docker
On a normal Debian install, Docker usually starts automatically here.
If it is not running, start it manually.
sudo systemctl start docker
You can also confirm that it is enabled at boot.
sudo systemctl is-enabled docker
Step 11: Run the hello-world test container
sudo docker run hello-world
This is the quickest sanity check after a fresh install. It shows that the client can talk to the daemon, Docker can pull an image, and containers can start normally.
Step 12: Confirm the installed versions
docker --version
docker compose version
If those commands return cleanly, you have a working Docker CLI and the Compose plugin is available too.
Optional: Run Docker without sudo
A lot of people prefer not to type sudo for every Docker command.
Add your user to the docker group:
sudo usermod -aG docker $USER
Apply the new group membership in your current shell:
newgrp docker
Then test Docker again without sudo:
docker run hello-world
Be careful with this convenience step. Membership in the docker group is effectively root-level access.
Troubleshooting a rough first install
If Docker does not come up cleanly, these checks usually tell you where it went sideways.
Check the service logs
sudo journalctl -u docker --no-pager -n 50
Confirm the repository file is in place
cat /etc/apt/sources.list.d/docker.sources
Verify Debian sees the Docker packages
apt-cache policy docker-ce
Check for leftover conflicting packages
dpkg -l | grep -E 'docker|containerd|runc'
The usual first-install problems are:
- the wrong repository file or codename in
docker.sources - a missing or unreadable GPG key
- old
docker.ioor related packages still hanging around - skipping the second
apt updateafter adding the Docker repository
What to do next
Once Docker is working, the next step is usually one of these:
- Docker Compose for Self-Hosted Apps: A Beginner-Friendly Guide
- How to Use Caddy as a Reverse Proxy for Self-Hosted Apps
- How to Install Nextcloud with Docker Compose
- How to Install Vaultwarden with Docker Compose
With Docker installed properly, the rest of self-hosting usually gets a lot less annoying. That is a good place to start from.
Was this article helpful?
Let me know so I can keep improving.
