How to install and run Portainer on Ubuntu 22.04?


This page explains how to run Docker on Ubuntu 22.04. Portainer is a lightweight, open-source management UI for Docker. It allows users to manage and monitor Docker environments, including containers, images, networks, and volumes through a web-based graphical user interface. With Portainer, you can easily deploy, run, and manage containers, as well as configure and monitor the health of their Docker environments.

The following assumes Docker is already installed. If not, please read this page on how to install Docker on Ubuntu 22.04.

It also assume Docker can be used as non-root user.

The following has been tested with these versions:

Update your system

Start by updating your system with the following command:

sudo apt update -y && sudo apt upgrade -y

Persistant volume

Portainer needs persisting data (for storing user password for example). Let's create a docker volume to store this data:

docker volume create portainer_data

Once the volume is created, you can inspect the volume to get its location for example:

docker volume inspect portainer_data 

Start Portainer

Once the volume is created, run the following command to start portainer in a container:

docker run -d -p 9000:9000 --name=portainer --restart=always -v /var/run/docker.sock:/var/run/docker.sock -v portainer_data:/data portainer/portainer-ce

Here is the detail of each option:

Docker should download and run the Portainer image:

$ docker run -d -p 9000:9000 --name=portainer --restart=always -v /var/run/docker.sock:/var/run/docker.sock -v portainer_data:/data portainer/portainer-ce
Unable to find image 'portainer/portainer-ce:latest' locally
latest: Pulling from portainer/portainer-ce
772227786281: Pull complete 
96fd13befc87: Pull complete 
0bad1d247b5b: Pull complete 
b5d1b01b1d39: Pull complete 
Digest: sha256:f7607310051ee21f58f99d7b7f7878a6a49d4850422d88a31f8c61c248bbc3a4
Status: Downloaded newer image for portainer/portainer-ce:latest

Once the image is launched, open your favorite web browser and go to the portainer URL localhost:9000:

Portainer first start

The first time Portainer starts, it asks you to set a password. The password must be at least 12 characters. Once the password is entered, the following page should appear in the browser:

Portainer quick setup

Select Get Started (unless you need to connect to another environments). You should see at least one environment named local

Portainer environments list

Select the local environment, you should at least see

Navigate through the user interface to discover all the possibilities of Portainer. Reboot the machine and check that Portainer is launched at startup.

That's all folks!

See also

Last update : 12/28/2022