Install Portainer on Debian 11/Debian 10

|
Last Updated:
|
|

In this tutorial, you will learn how to install Portainer on Debian 11/Debian 10. Portainer is a self-service container service delivery platform that provides container management GUI for Kubernetes, Docker and Swarm.

Install Portainer on Debian 11/Debian 10

Portainer is available as both Community Edition and Business Edition. We will be installing the Community Edition in this guide.

There are different environments in which you can deploy Portainer;

  1. Standalone Docker container
  2. Docker Swarm
  3. Kubernetes

In this tutorial, we will run Portainer as a standalone Docker container.

You can also check how to setup Portainer with SSL certificates by following the link below;

Setup Portainer with SSL Certificates

Install Docker on Debian 11/Debian 10

To begin with, you need to install Docker on Debian 11/Debian 10 by running the commands below;

apt update -y && apt install curl gnupg2 -y
curl -fsSL https://download.docker.com/linux/debian/gpg \
| gpg --dearmor > /etc/apt/trusted.gpg.d/docker.gpg
echo \
"deb [arch=$(dpkg --print-architecture)] https://download.docker.com/linux/debian $(lsb_release -cs) stable" \
| tee /etc/apt/sources.list.d/docker.list > /dev/null
apt update
sudo apt install docker-ce docker-ce-cli containerd.io

Start and enable Docker to run on system boot;

systemctl enable --now docker

Create Portainer Server Docker Data Volume

Once the Docker is in place, it is now time to deploy Portainer on Debian 11/Debian 10.

To begin with, you need to create Portainer server data volume. Please note that Portainer requires persistent storage in order to maintain the database and configuration information it needs to function.

You can create a Docker volume using the command;

docker volume create [OPTIONS] [VOLUME-NAME]

For example, to create a volume called pt_data, you can use the command. Name can be anything of your preference.

docker volume create pt_data

You can confirm the volumes by listing them;

docker volume ls

Sample output;

DRIVER    VOLUME NAME
local     pt_data

The voume is created under the Docker host path, /var/lib/docker/volumes/. See the output from the command below;

docker volume inspect pt_data
[
    {
        "CreatedAt": "2022-06-09T17:56:05Z",
        "Driver": "local",
        "Labels": {},
        "Mountpoint": "/var/lib/docker/volumes/pt_data/_data",
        "Name": "pt_data",
        "Options": {},
        "Scope": "local"
    }
] 

Install Portainer as Standalone Docker Container

Next, download and install Portainer server Docker container on Debian 11/Debian 10;

docker run -d -p 8000:8000 -p 9443:9443 --name portainer \
--restart=always -v /var/run/docker.sock:/var/run/docker.sock \
-v pt_data:/data portainer/portainer-ce:latest
  • Note that the Portainer Server listens on port TCP 9443 for the UI and API and on an optional port TCP 8000, which is only required if using Edge Compute features with Edge Agents.
  • The Portainer Agents listen on TCP port 9001

Demystifying the Docker command line options used above;

  • -d/--detach: Causes the container to run in the background and print container ID
  • -p/--publish: Exposes/Publishes a container’s port(s) to the host.
    • For example, 9443:9443 means Portainer server container port 9443 can be accessed on the main Docker host on port 9443.
  • --name: Assign a name to the container.
  • --restart: Restart policy to apply when a container exits (default “no”)
    • always means Always restart the container regardless of the exit status
    • it also causes the container to start on daemon startup, regardless of the current state of the container
  • -v/--volume: Bind mount a Docker container volume.
    • -v /var/run/docker.sock:/var/run/docker.sock: This causes the Portainer Server container process to communicate with the main host Docker process.
    • -v pt_data:/data: Mounts the Portainer Server container data, /data, to the host path /var/lib/docker/volumes/pt_data.
  • And then of course the Portainer image we are using, the Portainer CE latest container image, portainer/portainer-ce:latest.

Read more on docker run --help.

Sample output from the command above;

Unable to find image 'portainer/portainer-ce:latest' locally
latest: Pulling from portainer/portainer-ce
772227786281: Pull complete 
96fd13befc87: Pull complete 
dc6f8e90d5b4: Pull complete 
0e84c6386ab3: Pull complete 
Digest: sha256:52f9fdee1e4acfb1b5c4ddd15c88905287efb6e8f8058d2c5a2543ddc72e9dc0
Status: Downloaded newer image for portainer/portainer-ce:latest
1d4d3952f3814e94c3237050bcc04ceaf8da7463e025d70397167d790532fc75

Portainer server should now be running.

You can list running Docker container using the command;

docker ps

Sample output;

CONTAINER ID   IMAGE                           COMMAND        CREATED              STATUS              PORTS                                                                                            NAMES
1d4d3952f381   portainer/portainer-ce:latest   "/portainer"   About a minute ago   Up About a minute   0.0.0.0:8000->8000/tcp, :::8000->8000/tcp, 0.0.0.0:9443->9443/tcp, :::9443->9443/tcp, 9000/tcp   portainer

You can confirm that actually, the Portainer server UI port is opened on the host as well.

ss -altnp | grep 9443
LISTEN    0         128                0.0.0.0:9443             0.0.0.0:*        users:(("docker-proxy",pid=4897,fd=4))                                         
LISTEN    0         128                   [::]:9443                [::]:*        users:(("docker-proxy",pid=4903,fd=4))

Accessing Portainer Server Web Interface

Portainer server web services is exposed to the Docker host on port 9443/TCP.

In order to access Portainer server UI, then navigate to the browser and enter the address https://docker-domain-or-IP:9443

If Firewall is running, ensure that your open port 9443/TCP to allow external access to Portainer web service.

Accept the self-signed SSL exception and proceed to Portainer server web interface.

Install Portainer on Debian 11/Debian 10

Create Admin user and password by entering password and click Create User.

You should then land on the Portainer server web interface.

Install Portainer on Debian 11/Debian 10

Home;

portainer home environment

Dashboard;

Install Portainer on Debian 11/Debian 10

And there you go. That concludes our guide on how to install Portainer as a Docker container on Debian 11/Debian 10.

Further Reading

Portainer Documentation

Other Tutorials

Install Portainer on Rocky Linux

Install and Run MariaDB as a Docker Container

Deploy a Single Node Elastic Stack Cluster on Docker Containers

SUPPORT US VIA A VIRTUAL CUP OF COFFEE

We're passionate about sharing our knowledge and experiences with you through our blog. If you appreciate our efforts, consider buying us a virtual coffee. Your support keeps us motivated and enables us to continually improve, ensuring that we can provide you with the best content possible. Thank you for being a coffee-fueled champion of our work!

Photo of author
koromicha
I am the Co-founder of Kifarunix.com, Linux and the whole FOSS enthusiast, Linux System Admin and a Blue Teamer who loves to share technological tips and hacks with others as a way of sharing knowledge as: "In vain have you acquired knowledge if you have not imparted it to others".

Leave a Comment