SustainableWWW Logo
Blog post image

Having Docker on a Raspberry Pi is awesome because you can run multiple containers, web services, and websites without any hassle. Keeping track of all these different containers, images, volumes and networks can be quite hard when you don't have a visual interface to work with.

This is where Portainer comes into the picture! Portainer is a free container-management system that allows you to manage, start and stop containers, volumes, networks, and much more in a web interface instead of in the console.

In this tutorial, we will be installing Portainer on your Raspberry Pi, so that you easily can manage your Docker containers in one place. Portainer will be running through Docker, so if you haven't already installed Docker, please follow our guide here: How to install Docker on a Raspberry Pi 4.

Install Portainer Web UI on a Raspberry Pi

To be able to go through this tutorial you are required to have a Raspberry Pi running the Raspbian OS and have an internet connection. It should also have Docker installed since Portainer will be using Docker to run. If you already have all these steps in order, please start with step one to begin the installation.

Step 1: Install Portainer using Docker

The first step is to install Portainer using Docker and to do that, we need to download the latest Portainer image from Docker Hub. You can copy/paste the line below to download the latest ARM image that fits your Raspberry Pi.

sudo docker pull portainer/portainer-ce:latest

Once the image has been downloaded to your Raspberry Pi you can copy/paste the line below to start it using Docker.

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

The line above is telling Docker to run the image as a container, and that it should be using port 9443. We are also telling Docker what to name this container and that we want it to automatically restart if something goes wrong. At the end of the line, we are telling it where to store the data and which image it should be using.

Once Docker is done spinning up your new Portainer web interface, you should be able to access it by going to [Raspberry-Pi-Ip]:9443. In our case that would be 192.168.100.101:9443.

Step 2: Initial Portainer setup

The first time you access Portainer you will have to go through the initial setup steps, but don't worry they are very easy. The first step is to create a Portainer user that will be administrating the different containers you are running. Please write down the username and password since this will be the administrative user.

After creating the administrator account you have to declare where your Docker container will be running so that Portainer knows which ones to show you. You will get 3 options which are "Docker", "Kubernetes" and "Agent". In this section, you should choose "Docker" since you will be running your images locally on your Raspberry Pi and it will be Docker that manages them.

After going through the initial setup you will be directed to the web interface where you can manage your Docker containers. If you in the Dashboard click on the endpoint called "local" you will be able to see your local Docker containers. There should already be one since Portainer is a Docker container.

Wrapping up

By this time you should have Portainer installed on your Raspberry Pi running Docker. It is a smart little piece of software that makes managing Docker containers easier and we hope that it will bring as much joy to you as it has brought us.

If you rather want a visual video to show you how to install Portainer on your Raspberry Pi, please consider clicking here to watch how to install both Docker and Portainer.

Lastly, if you have experienced any problems installing Portainer on your Raspberry Pi, please comment below. You are also very welcome to comment with your experiences and advice in case you have something to add to this article.