Tag: installation

  • 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

  • Install Portainer on Debain

    Let’s get Portainer installed!

    You can either run these commands as ‘sudo’ or run ‘sudo -i’ to run these commands as root.

    All we need is at least SSH access and/or ftp access(to make it easier for file editing), but that is optional if you just want to quickly get this installed.

    Quick Rundown: All we need to do is SSH into the device we want to install Portainer on, configure the ‘compose.yaml’ file and run it.

    First, SSH into the device with your tool of choice. Ex. Putty, CMD, Terminal, etc.

    In my case, I use nano:

    Edit compose file with nano

    Paste this for the base config:

    services:
      portainer:
        image: portainer/portainer-ce:latest
        container_name: portainer
        restart: always
        ports:
          - "9443:9443"
        volumes:
          - /var/run/docker.sock:/var/run/docker.sock
          - /home/hassio/home_assistant/portainer_data:/data
        environment:
          - TZ=change_me
    YAML

    So we have:

    services:
      portainer:
        image: portainer/portainer-ce:latest
        container_name: portainer
    YAML

    Which defines the name of the container to Docker ‘portainer’, you will use this to modify the container later.

    image: portainer/portainer-ce:latest
    YAML

    Tells Docker what image to run. ‘portainer/portainer-ce‘ is Portainer’s Community Edition, ‘:latest’ is the tag, it will pull the newest latest tag on startup.

    restart: always
    YAML

    This is the Docker restart policy. If the container stops (or the host reboots), Docker will automatically try to start it.

        ports:
          - "9443:9443"
    YAML

    Maps host port 9443 to container port 9443. Portainer uses 9443 for the HTTPS web UI by default. After it starts, you’ll access Portainer at https://<host-ip>:9443.

        volumes:
          - /var/run/docker.sock:/var/run/docker.sock
    YAML

    This binds the Docker socket into the container. This is what gives Portainer the ability to control Docker (list containers, start/stop, create volumes, etc.). VERY powerful: any process that can talk to the Docker socket can control the Docker daemon (and therefore the host).

        volumes:
          - /home/hassio/home_assistant/portainer_data:/data
    YAML

    A host directory mounted into the container’s /data — used by Portainer to store its state (users, settings, DB). This ensures data persists after container upgrades.

    Make sure to create a folder so Portainer can store its data. In my case, I put it under my users folder ‘/home/hassio/home_assistant/portainer_data’, but you would probably want to do something like ‘/home/’your username’/portainer_data’ instead. If you copied the file, make sure to change ‘/home/hassio/home_assistant/portainer_data’ to what suits your needs.

        environment:
          - TZ=change_me
    YAML

    This sets the timezone inside the container so logs and scheduled tasks use that timezone. Cosmetic but helpful. Make sure to change the timezone name or delete it.

    All you have to do next is change the Timezone, based on the name you find here.

    You can see my post on how to set the timezone here if you need more info on that.

    sudo docker compose -f compose.yaml config
    Bash

    All you need to do next is run that command, replacing ‘compose.yaml’ with your filename, to validate your Compose file.

    sudo docker compose -f compose.yaml up -d
    Bash

    That brings the container up.

    sudo docker compose ps
    Bash

    You can see the status of your running containers with that.

    sudo docker ps --filter name=portainer
    Bash

    Or use this one to specifically see the status of Portainer if you have multiple containers running. Make sure to change ‘portainer’ to the name that was used in the configuration file.

    sudo docker compose logs -f portainer
    Bash

    With this one, you can see the log file.

    Now your Portainer container should be up and running!

    Navigate to ‘https://<host-ip>:9443’, replacing the port number if you changed it in the compose file and replacing ‘<host-ip>’ with the device’s actual IP address.

    Make sure to create a strong password, as anyone who has it will be able to change your containers and potentially do malicious things.

    Here is the Portainer Installation Documentation if you wish to view it.

    I hope this helped you out! Have a great day and have fun building containers!

    Leave a comment if you need any help. I’ll be glad to support you!