# How to install Portainer on Docker

Portainer is a convenient **way to manage distributed container environments**. The software is installed as a Docker container and thus runs pretty much everywhere. We show the installation routine and provide useful tips.

Tip Use Portainer to manage your Kubernetes clusters – on a IONOS [vServer](https://www.ionos.com/servers/vps "Rent vServer affordably at IONOS").

## What is Portainer?

We had already introduced [Portainer](https://www.Portainer.io/ "Container Management GUI for Kubernetes, Docker, Swarm - Portainer") as a flexible **[alternative to OpenShift](https://www.ionos.com/digitalguide/server/know-how/openshift-alternatives/ "OpenShift alternatives ")**. Unlike OpenShift, Portainer is not a Kubernetes distribution in its own right. Rather, the open source software centralizes and unifies the management of existing cluster infrastructures. A web-based graphical user interface is used for this purpose. In addition to the free “Community Edition” (CE), there is a paid version with enterprise support.

The main focus of Portainer is to unify the **management of existing Kubernetes deployments**. Portainer enables DevOps teams to centrally manage, configure, and secure multi-cluster environments. Development teams also benefit from the software; for example, Portainer facilitates deployment, management and troubleshooting of applications.

Conveniently, Portainer is not only suitable as a management interface for [Kubernetes](https://www.ionos.com/digitalguide/server/know-how/what-is-kubernetes/ "What is Kubernetes?"); **cluster or container management** based on Docker and [Docker Swarm](https://www.ionos.com/digitalguide/server/know-how/docker-orchestration-with-swarm-and-compose/ "Docker orchestration with Swarm and Compose") is also part of the functional scope. The software can be installed just about anywhere. Thus, the installation works in cloud environments, on edge devices as well as on your own on-premises computing infrastructure. We show how to install Portainer under Docker.

Tip Follow our demonstrative [Docker tutorial](https://www.ionos.com/digitalguide/server/configuration/docker-tutorial-installation-and-first-steps/ "Docker tutorial: Installation and first steps") to set up Docker on your local system.

## How do I install Portainer on Docker?

Let’s first look at the basic Portainer architecture. This comprises two components that are installed individually as [Docker containers](https://www.ionos.com/digitalguide/server/know-how/docker-container/ "Docker container"):

1. **A Portainer server** as a centralized instance. The Portainer server contains a database and requires a storage layer to store data. The Portainer server manages the local [Docker environment](https://www.ionos.com/digitalguide/server/know-how/what-is-docker/) and, if necessary, other environments connected via agents.
2. If necessary, **multiple Portainer agents** to manage additional environments. One instance of the Portainer agent runs on each cluster node to be managed.

Both Portainer server and agents run **as containers on existing infrastructure**. The agents communicate with the server; for this to work, the server and the agents must be on the same network. Furthermore, there are the edge agents, which run as instances on remote devices. What is special about edge agents is that they communicate with the server across network boundaries. An encrypted TLS tunnel is used for this.

Next, we demonstrate the **installation of a Portainer server and agent under Docker** (standalone). We refer to Portainer Community Edition (CE) version 2.9.3 and use Docker Desktop as a base. Docker Desktop runs on Windows and macOS; installation on Linux is nearly identical. Note that in production use, servers and agents run on different machines.

### Installing Portainer Server under Docker Desktop

Since the **Portainer server is available as a Docker image**, installation turns out to be quite simple. We will guide you through the process step by step.

1. First, we create a **Docker volume** that will contain the data managed by the Portainer server:

```none
docker volume create Portainer_data
```

2. **Next, we verify** that the Docker volume named “Portainer\_data” exists:

```none
docker volume ls
```

3. Now let’s move on to the **installation of the actual Portainer server**. We start the server as a Docker container from its Docker image. Unless the image is local, it will be downloaded automatically:

```none
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 \
    cr.Portainer.io/Portainer/Portainer-ce:2.9.3
```

4. **Next, we check** if the Docker container named “Portainer” is running:

```none
docker ps
```

### Configure the Portainer server under Docker

If the Portainer server was installed correctly, the **Portainer web interface is accessible on the local host** at the specified port. In our case, it is port 9443. Now it is time to configure the Portainer server.

[![Image: Splash screen when accessing the Portainer web interface for the first time](https://www.ionos.com/digitalguide/fileadmin/_processed_/5/e/csm_startbildschirm-portainer-weboberflaeche_8a3921571d.webp "Splash screen when accessing the Portainer web interface for the first time")](https://www.ionos.com/digitalguide/fileadmin/DigitalGuide/Screenshots_2022/startbildschirm-portainer-weboberflaeche.png) Splash screen when accessing the Portainer web interface for the first time [![Image: Portainer splash screen with admin user details entered](https://www.ionos.com/digitalguide/fileadmin/_processed_/f/3/csm_startbildschirm-portainer-admin-nutzerdaten_b32a303322.webp "Portainer splash screen with admin user details entered")](https://www.ionos.com/digitalguide/fileadmin/DigitalGuide/Screenshots_2022/startbildschirm-portainer-admin-nutzerdaten.png) Portainer splash screen with admin user details entered [![Image: Quick Setup Wizard of the Portainer web interface](https://www.ionos.com/digitalguide/fileadmin/_processed_/7/8/csm_quick-setup-wizard-portainer_da088bc42c.webp "Quick Setup Wizard of the Portainer web interface")](https://www.ionos.com/digitalguide/fileadmin/DigitalGuide/Screenshots_2022/quick-setup-wizard-portainer.png) Quick Setup Wizard of the Portainer web interface [![Image: Home screen of the Portainer web interface](https://www.ionos.com/digitalguide/fileadmin/_processed_/7/4/csm_home-bildschirm-portainer-weboberflaeche_e4a4f40178.webp "Home screen of the Portainer web interface")](https://www.ionos.com/digitalguide/fileadmin/DigitalGuide/Screenshots_2022/home-bildschirm-portainer-weboberflaeche.png) Home screen of the Portainer web interface [![Image: Dashboard of the Portainer web interface.](https://www.ionos.com/digitalguide/fileadmin/_processed_/9/9/csm_dashboard-portainer-weboberflaeche_1b59ef741e.webp "Dashboard of the Portainer web interface.")](https://www.ionos.com/digitalguide/fileadmin/DigitalGuide/Screenshots_2022/dashboard-portainer-weboberflaeche.png) Dashboard of the Portainer web interface. 1. First, we call up the **Portainer web interface** in the browser: *https://localhost:9443*.
2. When using Portainer for the first time, we create an **admin user** account and then set up Portainer.

By default, the Portainer installation uses a **self-signed SSL certificate** to secure the web interface via HTTPS. When accessed, a warning message may be displayed in the browser, depending on the browser and operating system. This can be bypassed with a few clicks, as shown in the following screenshots.

### Upgrade Portainer server under Docker Desktop

The Portainer server upgrade process is **closely related to the installation routine**. Therefore, we show the process here as well:

1. First, we **stop the running container of the** Portainer server:

```none
docker stop Portainer
```

2. Subsequently, **we remove the container**:

```none
docker rm Portainer
```

3. In preparation for the upgrade, **we download the latest Portainer server image**:

```none
docker pull cr.Portainer.io/Portainer/Portainer-ce:2.9.3
```

4. To **perform the upgrade**, we restart the Portainer server container from the current image:

```none
docker run -d -p 8000:8000 -p 9000:9000 -p 9443:9443 \
    --name=Portainer --restart=always \
    -v /var/run/docker.sock:/var/run/docker.sock \
    -v Portainer_data:/data \
    cr.Portainer.io/Portainer/Portainer-ce:2.9.3
```

### Installing Portainer agent under Docker

The Portainer agent is not needed for a local installation under Docker. If you want to **manage multiple environments in a centralized way**, you install the agent on each machine to be connected. Since the Portainer agent is available as a Docker container, installation is straightforward. All you need to do is run the following command on the target system:

```none
docker run -d -p 9001:9001 --name Portainer_agent \
    --restart=always \
    -v /var/run/docker.sock:/var/run/docker.sock \
    -v /var/lib/docker/volumes:/var/lib/docker/volumes \
    cr.Portainer.io/Portainer/agent:2.9.3
```


This is a markdown version of: [https://www.ionos.com/digitalguide/server/configuration/install-portainer-under-docker/](https://www.ionos.com/digitalguide/server/configuration/install-portainer-under-docker/) for AI/LLM consumption.