Category: Debian Tutorials

  • 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

  • Debian, Give User Sudo Access

    Here’s a quick tutorial on giving a user sudo access on Debian.

    I’m going to assume SSH access is set up, and you can log in to root, or you have terminal access on the host system.

    After you’re logged in as root, all we have to do is run a simple command.

    usermod -AG sudo username
    Bash

    usermod means we want to modify the users on the system.

    -AG, A stands for add, and G stands for group.

    In this case, we want to add a user to the sudo group.

    Then username is the user you want to add to the group.

    Replace username with the user that you want to give sudo access to.

    If nothing shows up for an error, and it goes back to the enter command line. Something like root@debian-dell:~# then you’re all set!

    Leave a comment if you need any help.

    I hope you have fun and a great day!