Page cover image

Setting Up Portainer on Raspberry Pi

Setting Up Portainer on Raspberry Pi

Portainer is a lightweight management UI that allows you to easily manage your Docker containers, images, networks, and volumes. This guide will walk you through the steps to install and configure Portainer on your Raspberry Pi.

Prerequisites

  • Raspberry Pi running the latest version of Raspberry Pi OS

  • Docker installed on your Raspberry Pi (refer to the guide on installing Docker)

  • SSH access to your Raspberry Pi (for headless setup)

Step 1: Update your Raspberry Pi

Before installing Portainer, ensure your Raspberry Pi is up to date by running the following commands:

sudo apt update
sudo apt upgrade

Step 2: Install Portainer

Pull the latest Portainer Docker image by running the following command:

sudo docker pull portainer/portainer-ce:latest

Run the Portainer container using the following command:

sudo 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:latest

This command does the following:

  • Runs the container in detached mode (-d)

  • Maps the container's port 9000 to the host's port 9000 (-p 9000:9000)

  • Names the container "portainer" (--name=portainer)

  • Automatically restarts the container if it stops (--restart=always)

  • Mounts the Docker socket and Portainer data directory as volumes (-v /var/run/docker.sock:/var/run/docker.sock -v portainer_data:/data)

Step 3: Access the Portainer Web Interface

Open a web browser and enter the following URL, replacing [PIIPADDRESS] with your Raspberry Pi's IP address:

http://[PIIPADDRESS]:9000

For this Raspberry Pi. The address is:

  1. On the initial setup page, create an admin account by providing a username and a strong password (at least 12 characters long).

  2. Select the "Docker" environment and click "Connect" to connect Portainer to your Raspberry Pi's Docker installation.

Username: your username

Password: your password

Using Portainer

  1. Once logged in, you'll see the Portainer dashboard displaying an overview of your Docker environment.

  2. To manage containers, click on the "Containers" option in the sidebar. Here you can view, start, stop, and remove containers.

  3. To create a new container, click the "Add container" button and provide the necessary details such as the image, port mappings, and restart policy.

  4. Explore the other options in the sidebar to manage images, networks, volumes, and more.

Conclusion

Congratulations! You have successfully installed and configured Portainer on your Raspberry Pi. You can now easily manage your Docker containers and resources through the intuitive web interface. Enjoy the convenience and power of Portainer!

Last updated

Was this helpful?