# Install Portainer on Debain

- Link: https://sythsaz.ca/2025/11/zashtys/install-portainer-on-debain/
- Published: 2025-11-04T10:39:52-07:00
- Author: sythsaz

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](https://r2.sythsaz.ca/2025/11/nano-compose-edit-1.
png)

Paste this for the base config:

  <!– wp:kevinbatdorf/code-block-pro {"code":"services:n portainer:n image: portainer/
portainer-ce:latestn container_name: portainern restart: alwaysn ports:n – "9443:
9443"n volumes:n – /var/run/docker.sock:/var/run/docker.sockn – /home/hassio/home_assistant/
portainer_data:/datan environment:n – TZ=change_me","codeHTML":"

    ```github-light
    services:n  portainer:n    image: portainer/portainer-ce:latestn    container_name: portainern    restart: alwaysn    ports:n      - "9443:9443"n    volumes:n      - /var/run/docker.sock:/var/run/docker.sockn      - /home/hassio/home_assistant/portainer_data:/datan    environment:n      - TZ=change_me
    ```

“,”language”:”yaml”,”theme”:”github-light”,”bgColor”:”#fff”,”textColor”:”#24292e”,”
fontSize”:”.875rem”,”fontFamily”:”Code-Pro-JetBrains-Mono”,”lineHeight”:”1.25rem”,”
clampFonts”:false,”lineNumbers”:true,”headerType”:”none”,”disablePadding”:false,”
footerType”:”simpleStringEnd”,”enableMaxHeight”:false,”seeMoreType”:””,”seeMoreString”:””,”
seeMoreAfterLine”:””,”seeMoreTransition”:false,”seeMoreCollapse”:false,”seeMoreCollapseString”:””,”
highestLineNumber”:12,”highlightingHover”:false,”lineHighlightColor”:”rgba(16, 41,
67, 0.2)”,”copyButton”:true,”copyButtonType”:”twoSquares”,”copyButtonUseTextarea”:
true,”useTabs”:false} –>

    ```github-light
    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:

  <!– wp:kevinbatdorf/code-block-pro {"code":"services:n portainer:n image: portainer/
portainer-ce:latestn container_name: portainer","codeHTML":"

    ```github-light
    services:n  portainer:n    image: portainer/portainer-ce:latestn    container_name: portainer
    ```

“,”language”:”yaml”,”theme”:”github-light”,”bgColor”:”#fff”,”textColor”:”#24292e”,”
fontSize”:”.875rem”,”fontFamily”:”Code-Pro-JetBrains-Mono”,”lineHeight”:”1.25rem”,”
clampFonts”:false,”lineNumbers”:true,”headerType”:”none”,”disablePadding”:false,”
footerType”:”simpleStringEnd”,”enableMaxHeight”:false,”seeMoreType”:””,”seeMoreString”:””,”
seeMoreAfterLine”:””,”seeMoreTransition”:false,”seeMoreCollapse”:false,”seeMoreCollapseString”:””,”
highestLineNumber”:4,”highlightingHover”:false,”lineHighlightColor”:”rgba(16, 41,
67, 0.2)”,”copyButton”:true,”copyButtonType”:”twoSquares”,”copyButtonUseTextarea”:
true,”useTabs”:false} –>

    ```github-light
    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.

<!– wp:kevinbatdorf/code-block-pro {"code":"image: portainer/portainer-ce:latest","
codeHTML":"

    ```github-light
    image: portainer/portainer-ce:latest
    ```

“,”language”:”yaml”,”theme”:”github-light”,”bgColor”:”#fff”,”textColor”:”#24292e”,”
fontSize”:”.875rem”,”fontFamily”:”Code-Pro-JetBrains-Mono”,”lineHeight”:”1.25rem”,”
clampFonts”:false,”lineNumbers”:true,”headerType”:”none”,”disablePadding”:false,”
footerType”:”simpleStringEnd”,”enableMaxHeight”:false,”seeMoreType”:””,”seeMoreString”:””,”
seeMoreAfterLine”:””,”seeMoreTransition”:false,”seeMoreCollapse”:false,”seeMoreCollapseString”:””,”
highestLineNumber”:1,”highlightingHover”:false,”lineHighlightColor”:”rgba(16, 41,
67, 0.2)”,”copyButton”:true,”copyButtonType”:”twoSquares”,”copyButtonUseTextarea”:
true,”useTabs”:false} –>

    ```github-light
    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.

<!– wp:kevinbatdorf/code-block-pro {"code":"restart: always","codeHTML":"

    ```github-light
    restart: always
    ```

“,”language”:”yaml”,”theme”:”github-light”,”bgColor”:”#fff”,”textColor”:”#24292e”,”
fontSize”:”.875rem”,”fontFamily”:”Code-Pro-JetBrains-Mono”,”lineHeight”:”1.25rem”,”
clampFonts”:false,”lineNumbers”:true,”headerType”:”none”,”disablePadding”:false,”
footerType”:”simpleStringEnd”,”enableMaxHeight”:false,”seeMoreType”:””,”seeMoreString”:””,”
seeMoreAfterLine”:””,”seeMoreTransition”:false,”seeMoreCollapse”:false,”seeMoreCollapseString”:””,”
highestLineNumber”:1,”highlightingHover”:false,”lineHighlightColor”:”rgba(16, 41,
67, 0.2)”,”copyButton”:true,”copyButtonType”:”twoSquares”,”copyButtonUseTextarea”:
true,”useTabs”:false} –>

    ```github-light
    restart: always
    ```

YAML

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

<!– wp:kevinbatdorf/code-block-pro {"code":" ports:n – "9443:9443"","codeHTML":"

    ```github-light
        ports:n      - "9443:9443"
    ```

“,”language”:”yaml”,”theme”:”github-light”,”bgColor”:”#fff”,”textColor”:”#24292e”,”
fontSize”:”.875rem”,”fontFamily”:”Code-Pro-JetBrains-Mono”,”lineHeight”:”1.25rem”,”
clampFonts”:false,”lineNumbers”:true,”headerType”:”none”,”disablePadding”:false,”
footerType”:”simpleStringEnd”,”enableMaxHeight”:false,”seeMoreType”:””,”seeMoreString”:””,”
seeMoreAfterLine”:””,”seeMoreTransition”:false,”seeMoreCollapse”:false,”seeMoreCollapseString”:””,”
highestLineNumber”:2,”highlightingHover”:false,”lineHighlightColor”:”rgba(16, 41,
67, 0.2)”,”copyButton”:true,”copyButtonType”:”twoSquares”,”copyButtonUseTextarea”:
true,”useTabs”:false} –>

    ```github-light
        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`.

<!– wp:kevinbatdorf/code-block-pro {"code":" volumes:n – /var/run/docker.sock:/var/
run/docker.sock","codeHTML":"

    ```github-light
        volumes:n      - /var/run/docker.sock:/var/run/docker.sock
    ```

“,”language”:”yaml”,”theme”:”github-light”,”bgColor”:”#fff”,”textColor”:”#24292e”,”
fontSize”:”.875rem”,”fontFamily”:”Code-Pro-JetBrains-Mono”,”lineHeight”:”1.25rem”,”
clampFonts”:false,”lineNumbers”:true,”headerType”:”none”,”disablePadding”:false,”
footerType”:”simpleStringEnd”,”enableMaxHeight”:false,”seeMoreType”:””,”seeMoreString”:””,”
seeMoreAfterLine”:””,”seeMoreTransition”:false,”seeMoreCollapse”:false,”seeMoreCollapseString”:””,”
highestLineNumber”:2,”highlightingHover”:false,”lineHighlightColor”:”rgba(16, 41,
67, 0.2)”,”copyButton”:true,”copyButtonType”:”twoSquares”,”copyButtonUseTextarea”:
true,”useTabs”:false} –>

    ```github-light
        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).

<!– wp:kevinbatdorf/code-block-pro {"code":" volumes:n – /home/hassio/home_assistant/
portainer_data:/data","codeHTML":"

    ```github-light
        volumes:n      - /home/hassio/home_assistant/portainer_data:/data
    ```

“,”language”:”yaml”,”theme”:”github-light”,”bgColor”:”#fff”,”textColor”:”#24292e”,”
fontSize”:”.875rem”,”fontFamily”:”Code-Pro-JetBrains-Mono”,”lineHeight”:”1.25rem”,”
clampFonts”:false,”lineNumbers”:true,”headerType”:”none”,”disablePadding”:false,”
footerType”:”simpleStringEnd”,”enableMaxHeight”:false,”seeMoreType”:””,”seeMoreString”:””,”
seeMoreAfterLine”:””,”seeMoreTransition”:false,”seeMoreCollapse”:false,”seeMoreCollapseString”:””,”
highestLineNumber”:2,”highlightingHover”:false,”lineHighlightColor”:”rgba(16, 41,
67, 0.2)”,”copyButton”:true,”copyButtonType”:”twoSquares”,”copyButtonUseTextarea”:
true,”useTabs”:false} –>

    ```github-light
        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.

<!– wp:kevinbatdorf/code-block-pro {"code":" environment:n – TZ=change_me","codeHTML":"

    ```github-light
        environment:n      - TZ=change_me
    ```

“,”language”:”yaml”,”theme”:”github-light”,”bgColor”:”#fff”,”textColor”:”#24292e”,”
fontSize”:”.875rem”,”fontFamily”:”Code-Pro-JetBrains-Mono”,”lineHeight”:”1.25rem”,”
clampFonts”:false,”lineNumbers”:true,”headerType”:”none”,”disablePadding”:false,”
footerType”:”simpleStringEnd”,”enableMaxHeight”:false,”seeMoreType”:””,”seeMoreString”:””,”
seeMoreAfterLine”:””,”seeMoreTransition”:false,”seeMoreCollapse”:false,”seeMoreCollapseString”:””,”
highestLineNumber”:2,”highlightingHover”:false,”lineHighlightColor”:”rgba(16, 41,
67, 0.2)”,”copyButton”:true,”copyButtonType”:”twoSquares”,”copyButtonUseTextarea”:
true,”useTabs”:false} –>

    ```github-light
        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](https://en.wikipedia.org/wiki/List_of_tz_database_time_zones).

You can see my post on how to [set the timezone here](https://sythsaz.ca/2025/11/04/docker-compose-set-timezone/)
if you need more info on that.

<!– wp:kevinbatdorf/code-block-pro {"code":"sudo docker compose -f compose.yaml 
config","codeHTML":"

    ```github-light
    sudo docker compose -f compose.yaml config
    ```

“,”language”:”bash”,”theme”:”github-light”,”bgColor”:”#fff”,”textColor”:”#24292e”,”
fontSize”:”.875rem”,”fontFamily”:”Code-Pro-JetBrains-Mono”,”lineHeight”:”1.25rem”,”
clampFonts”:false,”lineNumbers”:true,”headerType”:”none”,”disablePadding”:false,”
footerType”:”simpleStringEnd”,”enableMaxHeight”:false,”seeMoreType”:””,”seeMoreString”:””,”
seeMoreAfterLine”:””,”seeMoreTransition”:false,”seeMoreCollapse”:false,”seeMoreCollapseString”:””,”
highestLineNumber”:1,”highlightingHover”:false,”lineHighlightColor”:”rgba(16, 41,
67, 0.2)”,”copyButton”:true,”copyButtonType”:”twoSquares”,”copyButtonUseTextarea”:
true,”useTabs”:false} –>

    ```github-light
    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.

<!– wp:kevinbatdorf/code-block-pro {"code":"sudo docker compose -f compose.yaml 
up -d","codeHTML":"

    ```github-light
    sudo docker compose -f compose.yaml up -d
    ```

“,”language”:”bash”,”theme”:”github-light”,”bgColor”:”#fff”,”textColor”:”#24292e”,”
fontSize”:”.875rem”,”fontFamily”:”Code-Pro-JetBrains-Mono”,”lineHeight”:”1.25rem”,”
clampFonts”:false,”lineNumbers”:true,”headerType”:”none”,”disablePadding”:false,”
footerType”:”simpleStringEnd”,”enableMaxHeight”:false,”seeMoreType”:””,”seeMoreString”:””,”
seeMoreAfterLine”:””,”seeMoreTransition”:false,”seeMoreCollapse”:false,”seeMoreCollapseString”:””,”
highestLineNumber”:1,”highlightingHover”:false,”lineHighlightColor”:”rgba(16, 41,
67, 0.2)”,”copyButton”:true,”copyButtonType”:”twoSquares”,”copyButtonUseTextarea”:
true,”useTabs”:false} –>

    ```github-light
    sudo docker compose -f compose.yaml up -d
    ```

Bash

That brings the container up.

<!– wp:kevinbatdorf/code-block-pro {"code":"sudo docker compose ps","codeHTML":"

    ```github-light
    sudo docker compose ps
    ```

“,”language”:”bash”,”theme”:”github-light”,”bgColor”:”#fff”,”textColor”:”#24292e”,”
fontSize”:”.875rem”,”fontFamily”:”Code-Pro-JetBrains-Mono”,”lineHeight”:”1.25rem”,”
clampFonts”:false,”lineNumbers”:true,”headerType”:”none”,”disablePadding”:false,”
footerType”:”simpleStringEnd”,”enableMaxHeight”:false,”seeMoreType”:””,”seeMoreString”:””,”
seeMoreAfterLine”:””,”seeMoreTransition”:false,”seeMoreCollapse”:false,”seeMoreCollapseString”:””,”
highestLineNumber”:1,”highlightingHover”:false,”lineHighlightColor”:”rgba(16, 41,
67, 0.2)”,”copyButton”:true,”copyButtonType”:”twoSquares”,”copyButtonUseTextarea”:
true,”useTabs”:false} –>

    ```github-light
    sudo docker compose ps
    ```

Bash

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

<!– wp:kevinbatdorf/code-block-pro {"code":"sudo docker ps –filter name=portainer","
codeHTML":"

    ```github-light
    sudo docker ps --filter name=portainer
    ```

“,”language”:”bash”,”theme”:”github-light”,”bgColor”:”#fff”,”textColor”:”#24292e”,”
fontSize”:”.875rem”,”fontFamily”:”Code-Pro-JetBrains-Mono”,”lineHeight”:”1.25rem”,”
clampFonts”:false,”lineNumbers”:true,”headerType”:”none”,”disablePadding”:false,”
footerType”:”simpleStringEnd”,”enableMaxHeight”:false,”seeMoreType”:””,”seeMoreString”:””,”
seeMoreAfterLine”:””,”seeMoreTransition”:false,”seeMoreCollapse”:false,”seeMoreCollapseString”:””,”
highestLineNumber”:1,”highlightingHover”:false,”lineHighlightColor”:”rgba(16, 41,
67, 0.2)”,”copyButton”:true,”copyButtonType”:”twoSquares”,”copyButtonUseTextarea”:
true,”useTabs”:false} –>

    ```github-light
    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.

<!– wp:kevinbatdorf/code-block-pro {"code":"sudo docker compose logs -f portainer","
codeHTML":"

    ```github-light
    sudo docker compose logs -f portainer
    ```

“,”language”:”bash”,”theme”:”github-light”,”bgColor”:”#fff”,”textColor”:”#24292e”,”
fontSize”:”.875rem”,”fontFamily”:”Code-Pro-JetBrains-Mono”,”lineHeight”:”1.25rem”,”
clampFonts”:false,”lineNumbers”:true,”headerType”:”none”,”disablePadding”:false,”
footerType”:”simpleStringEnd”,”enableMaxHeight”:false,”seeMoreType”:””,”seeMoreString”:””,”
seeMoreAfterLine”:””,”seeMoreTransition”:false,”seeMoreCollapse”:false,”seeMoreCollapseString”:””,”
highestLineNumber”:1,”highlightingHover”:false,”lineHighlightColor”:”rgba(16, 41,
67, 0.2)”,”copyButton”:true,”copyButtonType”:”twoSquares”,”copyButtonUseTextarea”:
true,”useTabs”:false} –>

    ```github-light
    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](https://docs.portainer.io/start/install/server/docker/linux#docker-compose)
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!
