# Setting Up Portainer on Raspberry Pi

### <mark style="color:blue;">**Setting Up Portainer on Raspberry Pi**</mark>

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.

### <mark style="color:blue;">**Prerequisites**</mark>

* 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)

<mark style="color:green;">**Step 1: Update your Raspberry Pi**</mark>&#x20;

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

```bash
sudo apt update
```

```bash
sudo apt upgrade
```

<mark style="color:green;">**Step 2: Install Portainer**</mark>

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

```bash
sudo docker pull portainer/portainer-ce:latest
```

Run the Portainer container using the following command:

```bash
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 <mark style="color:yellow;">**(**</mark><mark style="color:yellow;">**`-d`**</mark><mark style="color:yellow;">**)**</mark>
* Maps the container's port 9000 to the host's port 9000 <mark style="color:yellow;">**(**</mark><mark style="color:yellow;">**`-p 9000:9000`**</mark><mark style="color:yellow;">**)**</mark>
* Names the container "portainer" <mark style="color:yellow;">**(**</mark><mark style="color:yellow;">**`--name=portainer`**</mark><mark style="color:yellow;">**)**</mark>
* Automatically restarts the container if it stops <mark style="color:yellow;">**(**</mark><mark style="color:yellow;">**`--restart=always`**</mark><mark style="color:yellow;">**)**</mark>
* Mounts the Docker socket and Portainer data directory as volumes <mark style="color:yellow;">**(**</mark><mark style="color:yellow;">**`-v /var/run/docker.sock:/var/run/docker.sock -v portainer_data:/data`**</mark><mark style="color:yellow;">**)**</mark>

<mark style="color:green;">**Step 3: Access the Portainer Web Interface**</mark>

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

```bash
http://[PIIPADDRESS]:9000
```

For this Raspberry Pi.  The address is:

{% embed url="<http://192.168.68.64:9000/>" %}

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.

<mark style="color:green;">Username:</mark> your username

<mark style="color:green;">Password:</mark> your password

### <mark style="color:blue;">**Using Portainer**</mark>

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.

### <mark style="color:blue;">**Conclusion**</mark>&#x20;

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!


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://education.raspberrypiaustralia.online/setting-up-portainer-on-raspberry-pi.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
