Skip to main content

The Ultimate Portainer Starter Guide

·5 mins·
Guide Portainer
Table of Contents
Portainer - This article is part of a series.
Part 1: This Article

Useful links#

Official Docs: https://docs.portainer.io/

Install Portainer: Comunity Edition: https://docs.portainer.io/start/install-ce/server/docker/linux

Updating Portainer: https://docs.portainer.io/start/upgrade

Add Docker Enviroment: https://docs.portainer.io/admin/environments/add/docker

What is Portainer
#

In this guide I explain how to install Portainer. But before that, what exactly is Portainer?

Portainer is a graphical web interface that you host on your computer of choice to manage Docker containers.

It allows you to easily manage multiple Docker Deamons across multiple computers. It also makes managing container instances much easier than using the CLI.

In this guide I will not discuss Docker but only Portainer itself. Docker will be explained in another guide.

Installation
#

Which distro
#

To install Portainer, we first need docker itself. But it is also important on which OS you want to install it.

In this guide I will limit myself to Linux because it was designed for it.

Linux has countless distros but I will use Debian for simplicity. Also, Debian is the base for almost all Linux servers because of its stability so it is perfect for Docker. But you can also use Ubuntu as long as it uses the APT package manager it should work.

Install Scripts
#

In this section I will discuss the installation itself. All you have to do is open a terminal and run these scripts.

sudo apt-get update && sudo apt-get upgrade && sudo apt install docker docker-compose && sudo systemctl start docker && sudo systemctl enable docker
sudo docker volume create portainer_data
sudo 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 portainer/portainer-ce:latest

Once everything has been completed, you can now access Portainer in your browser. You can do this with these links:


For access if it is installed on the computer from where you want to access it

localhost:9443


or with the IP address of the server where Portainer was installed

e.g. 192.168.1.89:9443


What do the scripts?
#

Here I would like to go into more detail about what the scripts actually do.

If you don’t care, you can skip this section and go to Setting up Portainer.

Script 1
#

The first script consists of the following parts:

sudo apt-get update && sudo apt-get upgrade

sudo apt install docker docker-compose

sudo systemctl start docker && sudo systemctl enable docker

The first one updates the OS.

The second installs Docker and Docker-Compose with the apt package manager.

The third starts the Docker Deamon and adds it to the autostart.

Script 2
#

The second script has only one part.

sudo docker volume create portainer_data

This script gives the docker deamon the command to create a volume called portainer_data

The volume can be found under:

/var/lib/docker/volumes/

This is necessary so that Portainer does not lose its data after a restart. I will go into more detail in the Docker guide but the tldr version is that Docker containers cannot save their data. They are life images. Therefore it is necessary to tell Docker containers where they can store their data in order to not lose them.

Script 3
#

Script three consists of a few parts but in itself it is just a command with individual variables for the container

Here are the individual parts and what they actually do:


Here the Docker Deamon is told to start a deployment

sudo docker run -d


Ports for the container are defined here. The first before the : is the host port after the : is the container port.

Like this: Host –> 8000:8000 <–Container

The ports that are set are

8000 http

9443 https

-p 8000:8000 -p 9443:9443


The name of the container is defined here

–name portainer


Here you specify that the container should always restart. This means that when the computer restarts, the container also restarts

–restart=always


Here the container is told that it can access the docker.sock. The Docker socket manages all containers, without this access Portainer cannot manage or create containers.

-v /var/run/docker.sock:/var/run/docker.sock


Here Portainer is told where to save its data. It is placed in the volume portainer_data which was created by Script 2.

-v portainer_data:/data


And finally here the container is told which image it should use for this container. In this case Portainer-CE.

portainer/portainer-ce:latest

Setting up Portainer
#

Creation of the admin user
#

Now that you have opened the Portainer web interface. You will be asked for the user name you want to use. It will first suggest the name:

admin

But I recommend using a name other than admin or root, as these are too easy to guess and hackers know that many people don’t change the default names.

The password should also be as strong as possible. It is best to use a password manager and have one generated. I recommend KeepassXC for this.

After you have created the user, you will be taken to the dashboard. Here you can now click on

get startet

to add the Docker socket in Portainer.

Recommendations for settings
#

From now on you can use Portainer. But I still have a few recommendations.

If you click on Home at the top left, you can see all the environments that are currently available in Portainer.

At the moment the Environment Local should be there. You can rename it by clicking on edit. This can be found on the right, the icon looks like a pencil.

Here you can now change the name but you should also enter a puplic IP. This should be the IP address of the computer where this Docker Environment is installed.

The advantage is that if you open a container with its port in the Portainer interface, it will automatically use this Puplic IP. So other computers in the same network can open containers via the Portainer interface without always having to enter the IP address.

Support me
#

I hope this guide has helped you a lot. I would be very happy if you would join my Patreon or donate with Paypal. I am grateful for any support.

Thank you very much for reading and for your time.

support me on Patreon.
Donate via Paypal.

If you like to share this artikel click the icons below.

Portainer - This article is part of a series.
Part 1: This Article