How to deploy Portainer on Linux to easily manage your docker containers

How can we help?
< All Topics

How to deploy Portainer on Linux to easily manage your docker containers

This article will talk about how to deploy portainer on linux. In short, portainer is a tool that lets you manage your Docker containers using a user-friendly GUI. You can also easily manage your Docker images, run application stacks, and even manage a Kubernetes cluster.

Portainer comes in two editions. Community Edition (CE) and Business Edition (BE). Portainer CE is free and open-source while Portainer BE is a commercial version of Portainer. It offers dedicated support for sure.

Here we will focus on Portainer CE. So, let’s get right to it. Shall we?

TLDR (Too long didn’t read!)

  1. Install docker-ce latest
  2. Install Portainer CE
docker volume create portainer_data
docker run -d -p 8000:8000 -p 9000:9000 --name=portainer --restart=always -v /var/run/docker.sock:/var/run/docker.sock -v portainer_data:/data portainer/portainer-ce:2.6.3
  1. Access Portainer dashboard via https://THE-IP:9443
  2. Do the initial setup as shown on screen.


Portainer UI Overview

The main dashboard shows all connected environments. It could be either local docker environment (the one in which the Portainer deployed), remote docker environment, Kubernetes, etc.

If you click one of the environments, the left panel will show more menus that allow you to manage any docker things, from managing docker images, stack deployment, docker networks, volumes, etc.

Portainer also allows you to deploy application stacks using docker-compose-style yaml file.

And many more! I let you discover it by yourself!

Step-by-step Installation Guide

Assuming that the server is a freshly installed system, then always, do a full system upgrade before performing the install:

For Debian/Ubuntu-based systems:

sudo apt update && sudo apt upgrade -y

For RHEL-based systems:

sudo yum upgrade -y

Installing Docker Engine

Unless you already have docker in your system, this part can be skipped.

We will be using the official Docker’s repository to retrieve the docker binaries. First, import the official GPG key:

For Debian/Ubuntu-based systems only

curl -fsSL | sudo gpg --dearmor -o /usr/share/keyrings/docker-archive-keyring.gpg

Then proceed to import the repository:

For Debian/Ubuntu-based systems:

echo "deb [arch=$(dpkg --print-architecture) signed-by=/usr/share/keyrings/docker-archive-keyring.gpg] $(lsb_release -cs) stable" | sudo tee /etc/apt/sources.list.d/docker.list > /dev/null

For RHEL-based systems (make sure yum-utils has been installed)

sudo yum-config-manager --add-repo

Next, install the Docker Engine:

For Debian/Ubuntu-based systems:

sudo apt-get update
sudo apt-get install docker-ce docker-ce-cli

For RHEL-based systems:

sudo yum install docker-ce docker-ce-cli

After the installation is done, make sure that docker services are running automatically on-boot:

For both Debian and RHEL-based systems:

sudo systemctl enable docker --now

And finally, perform a test if the docker engine is running:

sudo docker run hello world

It should output something like this:

Hello from Docker!
This message shows that your installation appears to be working correctly.

To generate this message, Docker took the following steps:
 1. The Docker client contacted the Docker daemon.
 2. The Docker daemon pulled the "hello-world" image from the Docker Hub.
 3. The Docker daemon created a new container from that image which runs the
    executable that produces the output you are currently reading.
 4. The Docker daemon streamed that output to the Docker client, which sent it
    to your terminal.

To try something more ambitious, you can run an Ubuntu container with:
 $ docker run -it ubuntu bash

Share images, automate workflows, and more with a free Docker ID:

For more examples and ideas, visit:

Additional step, add your current user to docker group to allow running docker commands without sudo/root:

sudo usermod -aG docker $USER

Installing Portainer

This is the easiest part, believe me. Just copy paste these two commands and BOOM, you have your own Portainer installed.

First, create a docker volume to make Portainer configurations persistent

docker volume create portainer_data

Then run the Portainer container. Run it as-is unless you want to modify some configurations:

docker run -d -p 8000:8000 -p 9443:9443 --name portainer \
    --restart=always \
    -v /var/run/docker.sock:/var/run/docker.sock \
    -v portainer_data:/data \

And make sure it’s running by doing docker ps command:

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

It exposes TCP port 8000 and 9443, and make sure to allow them in your Firewall configuration and in the Security Profile as well.

Initial Setup

Access your Portainer dashboard via https://YOUR-IP:9443, and an initial setup page will show up. Fill in the required fields for the admin user. Then click Create User.

On the next page, click the Get Started option to directly configure the current local deployment install:

You’re all set! Now, you’re ready to use Portainer!

Deploy your first application

This section will demonstrate how to deploy your first app via Portainer dashboard.

Go to Containers menu, click Add container

For this example, I will deploy a simple Nginx webserver. Fill-in the necessary fields, like the following:

The rest I leave it to its default value. Then, click Deploy the container

After a few seconds your container will be deployed and it will show up int the containers list:

And if you access it, it works!


That is how you can successfully deploy your Portainer on Linux. Portainer lets you administer your docker apps deployment and management with ease!

Be rich on knowledge by checking more of our Knowledge Base articles here.

Table of Contents

Comments are closed.

Ready, Set, Cloud

Ready, Set, Cloud