Tag: compose

  • Installing Docker on Debian

    Here’s a quick tutorial on installing Docker and Docker Compose V2 on Debian! This requires that your account has sudo access.

    First, we have to make sure that we have possible conflicting packages removed. Debian may ship older/unofficial packages that conflict with Docker’s official packages.

    sudo apt remove docker docker-engine docker.io containerd runc docker-compose docker-doc podman-docker
    Bash

    After that finishes, we can start installing Docker. Enter these line by line, minus the added comment(#) lines.

    sudo apt update
    sudo apt install -y ca-certificates curl gnupg lsb-release
    
    # Create keyring dir (if not exists) and add Docker GPG key
    sudo mkdir -p /etc/apt/keyrings
    curl -fsSL https://download.docker.com/linux/debian/gpg | sudo gpg --dearmor -o /etc/apt/keyrings/docker.gpg
    sudo chmod a+r /etc/apt/keyrings/docker.gpg
    
    # Add the Docker apt repo (uses your Debian codename)
    echo "deb [arch=$(dpkg --print-architecture) signed-by=/etc/apt/keyrings/docker.gpg] https://download.docker.com/linux/debian $(lsb_release -cs) stable" | sudo tee /etc/apt/sources.list.d/docker.list > /dev/null
    
    # Apply changes to apt
    sudo apt update
    Bash

    Next, we will install Docker Engine, the CLI, containerd, Buildx, and the Docker Compose plugin (Compose V2).

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

    Then we start and enable Docker.

    sudo systemctl enable --now docker
    Bash

    This is optional, but it’s nice to have.

    We can add the current user to the Docker group, so we don’t have to run sudo all the time when we use Docker commands.

    sudo usermod -aG docker $USER
    Bash

    After adding yourself to the Docker group, you must re-login to apply the changes.

    Next, we can verify it’s working with the commands.

    docker version
    sudo docker run --rm hello-world
    Bash

    The first one shows the version of Docker that is installed, while the second one runs the hello-world container.

    As of writing this, my Docker version outputs something like this:
    Client:
    Version: 26.1.5+dfsg1
    API version: 1.45
    Go version: go1.24.4
    Git commit: a72d7cd
    Built: Wed Jul 30 19:37:00 2025
    OS/Arch: linux/amd64
    Context: default
    Server:
    Engine:
    Version: 26.1.5+dfsg1
    API version: 1.45 (minimum version 1.24)
    Go version: go1.24.4
    Git commit: 411e817
    Built: Wed Jul 30 19:37:00 2025
    OS/Arch: linux/amd64
    Experimental: false
    containerd:
    Version: 1.7.24~ds1
    GitCommit: 1.7.24~ds1-6+b4
    runc:
    Version: 1.1.15+ds1
    GitCommit: 1.1.15+ds1-2+b4
    docker-init:
    Version: 0.19.0
    GitCommit:

    docker compose version
    Bash

    This one will tell you what version of Docker Compose you have installed.

    As of writing this, my Docker Compose version outputs:
    Docker Compose version v2.40.3