Install + Configure

These instructions include how to install and configure Docker and its associated packages on a Debian host. As of the time of writing, the Debian version is Debian 13.

These instructions are based off the official Docker documentation[1][2].

Install Docker

Uninstall old versions

Before installing Docker, remove any old versions or components with the following command:

sudo apt remove $(dpkg --get-selections docker.io docker-compose docker-doc podman-docker containerd runc | cut -f1)

Set up apt repository

Add Docker’s official GPG key:

sudo apt update
sudo apt 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:

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

Update apt with the new repository:

sudo apt update

Install the Docker packages

To install the latest Docker packages, run the following command:

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

Make sure that Docker is running after install with:

sudo systemctl status docker

Post-install steps

Set up local logging driver

Rather than using the default json-file logging driver that ships with Docker, switch to the local logging driver that uses the native system logs.

  1. Open Docker’s configuration file:

    sudo nano /etc/docker/daemon.json
    

    Note

    For a fresh Docker install, the daemon.json file will likely be empty.

  2. Paste the following contents:

    daemon.json
    {
      "log-driver": "local",
      "log-opts": {
        "max-size": "10m"
      }
    }
    
  3. Save and close with Ctrl+X, Y to confirm, and Enter to select the save location.

  4. Restart Docker so it reads the new configuration file:

    sudo systemctl restart docker