Portainer is a web interface for Docker. Instead of typing every command into the terminal, you can see all your server’s containers, images, volumes, and networks in your browser, read logs, open a console inside a container, and start entire applications as a stack from a Compose file. In this guide, we’ll show you two ways to do this: the easy way, as a One-Click App, which makes Portainer Community Edition (CE) available over HTTPS in just a few clicks, and the manual installation with Docker Compose, where you set up the firewall and HTTPS yourself. You’ll also learn why Portainer needs access to the Docker socket and what that means for your server’s security.
Portainer isn’t a service for visitors; it’s a management tool. It’s a good fit for a VPS if:
- You run multiple containers and want to keep track of them: view their status, resource usage, ports, and volumes at a glance.
- You need logs and a console in your browser, for example, to quickly check why a container keeps restarting without logging in over SSH.
- You want to start applications from Compose files that you can edit and save in Portainer, then deploy again later.
- You manage multiple Docker servers centrally by connecting additional servers through the Portainer Agent.
Portainer is less useful if your server only runs a single container that you rarely touch. In that case, the docker compose command line is faster, and you avoid adding another interface with full access to your server.
The quickest way to get Portainer is through your VPS’s One-Click Apps. The app installs Portainer CE using the LTS version, makes it directly accessible over HTTPS with a domain, and automatically connects to Docker on your VPS the first time it starts. You don’t need to set up a reverse proxy, certificate, or firewall rules.
- A Linux VPS (Debian or Ubuntu) with One-Click Apps set up. See Set up One-Click Apps for instructions.
- SSH access (see SSH). You’ll need it once when you first log in to read the setup token from the logs.
- Open your VPS in the ZapX dashboard and switch to the One-Click Apps tab.
- Find Portainer in the app catalog and click Install app.
- Use a custom subdomain or zap.cloud is already selected with a random name. Leave this option enabled or enter a name of your own: you’ll use the domain to access Portainer over HTTPS.
- Portainer has no other required fields. You won’t set a password in the form; you’ll do that the first time you open Portainer.
- Click Queue installation. Portainer will be ready in one or two minutes.
You have 5 minutes after startup Portainer requires you to create the administrator account within 5 minutes of startup. So, display the setup token right after installation and create the account immediately. Once the time has expired, Portainer won’t accept any setup attempts. If that happens, restart the app from its app card and read the token from the logs again. Always use the most recently issued line.
Since version 2.43, Portainer requires a one-time setup token during setup. This prevents someone else who knows the address from creating the administrator account before you do. The token is only available in the container logs. Connect to your VPS over SSH and run:
docker logs $(docker ps -q --filter name=portainer) 2>&1 | grep setup_token
Copy the value after setup_token=. Then open the app’s Access link. Portainer displays the “New Portainer installation” page:
- The Username field is already set to
admin. You can change the name. - Enter a password of at least 12 characters under Password and Confirm password.
- Paste the token you copied into Setup token and click Create user.
- Skip the “Set up Edge Compute” step by clicking Skip. You only need Edge Compute for remote devices that use the Edge Agent.
- In the Environment Wizard, click Get Started. This uses the
localenvironment, which is Docker on your VPS.
You create the login details yourself. Portainer doesn’t have any automatically generated values under App environment in the app settings (gear icon), so the panel doesn’t know your password. Save it in your password manager right away.
The local environment appears under Home. When you click it, you’ll see more than just Portainer: you’ll see all containers on your VPS, including your other One-Click Apps and the containers that run the One-Click Apps themselves, such as coolify, coolify-proxy, coolify-db, and coolify-redis.
Don’t modify One-Click App containers in Portainer
Don’t stop, delete, or edit the coolify containers or the containers for your One-Click Apps in Portainer. One-Click Apps manage these containers themselves. Changes made in Portainer may be overwritten the next time an app restarts or updates, or, in the worst case, may prevent your apps from being managed. Always start, stop, and update One-Click Apps in the dashboard. Portainer is useful for viewing logs and resource usage and for running your own stacks.
Update Portainer from the app settings (gear icon) under App update. Click Check for updates, then install a new version with Apply update. If the page says the app is up to date, there isn’t a newer version in the app catalog yet. You can ignore the “New version available” message in the bottom-left corner of Portainer in that case; Portainer doesn’t update itself.
Your users, settings, and stacks are stored in a separate volume and are retained during updates. You can also download a backup of your Portainer settings under Settings, in the Back up Portainer section, by clicking Download backup. This doesn’t include your container data, which is stored in each container’s own volumes.
The rest of this guide covers the manual installation of Portainer CE with Docker Compose on your VPS. For example, you might use this method if you don’t use One-Click Apps on your server or want to configure every step yourself.
- A Linux VPS running Debian or Ubuntu, with SSH access. See First access via SSH.
- Docker and Docker Compose. See Install Docker. Check your installation with
docker --versionanddocker compose version. Portainer requires Docker to run as root and be accessible through the Unix socket, which is the case with a standard installation. - For HTTPS: a domain or subdomain whose A record points to your VPS’s IP address (e.g.,
portainer.example.com).
Portainer itself uses few resources, and the official documentation doesn’t specify fixed minimum requirements. The containers you manage with it will determine what you need. As a guideline for a server running Portainer and a few smaller applications:
| Hardware | Minimum | Recommended |
|---|---|---|
| CPU | 1 vCPU core | 2 vCPU cores |
| RAM | 1 GB | 2 GB |
| Storage | 10 GB | 20 GB |
Portainer is accessible as soon as it starts, and whoever first opens the page with a valid setup token can create the administrator account. So don’t expose the interface publicly in the first place. With ufw, allow only SSH and the ports for the reverse proxy:
ufw allow OpenSSH
ufw allow 80/tcp
ufw allow 443/tcp
ufw enable
Docker bypasses ufw
Ports published by Docker using ports: are accessible from outside even if ufw blocks them. Docker adds its own rules ahead of ufw’s. So, as shown in the Compose file below, bind Portainer only to 127.0.0.1. For more information about the firewall, see Firewall management on Linux.
Create a directory for Portainer and navigate to it:
mkdir -p /opt/portainer
cd /opt/portainer
Create the Compose file with nano docker-compose.yml. It’s based on the Compose file from the official Portainer documentation:
services:
portainer:
container_name: portainer
image: portainer/portainer-ce:lts
restart: always
volumes:
- /var/run/docker.sock:/var/run/docker.sock
- portainer_data:/data
ports:
- 127.0.0.1:9443:9443
volumes:
portainer_data:
name: portainer_data
Here’s what the entries mean:
image: The official Portainer CE image in thelts(Long Term Support) channel. If you want to manage updates yourself, specify a fixed version instead, such asportainer/portainer-ce:2.45.3./var/run/docker.sock: The Docker socket. Portainer uses it to manage Docker on your server.portainer_data:/data: Users, settings, and stacks are stored in theportainer_datavolume.127.0.0.1:9443:9443: The interface is available over HTTPS with a self-signed certificate, and can only be accessed from the server itself. The8000port from the official file is intentionally omitted; it’s only needed for Edge Agents.
Docker socket access means root access
Anyone who can use the Docker socket can start any container on the server, including containers that mount the host’s entire file system. An administrator account in Portainer is therefore practically as powerful as root on your VPS. Use a long, unique password, give accounts only to people you’d also give SSH access to, and don’t leave the interface exposed without HTTPS.
Start the container:
docker compose up -d
Check whether it’s running with docker compose ps.
You have 5 minutes after startup to create the administrator account. First, read the setup token from the logs:
docker logs portainer 2>&1 | grep setup_token
Since Portainer only listens on 127.0.0.1, you’ll access the interface through an SSH tunnel the first time. Run this command on your own computer:
ssh -L 9443:localhost:9443 root@SERVER_IP
Replace SERVER_IP with your VPS’s IP address, then open https://localhost:9443 in your browser. Confirm the warning about the self-signed certificate. Then set your username, password, and setup token as described above under “First login with a setup token,” skip Edge Compute, and click Get Started.
If you miss the 5-minute window, restart the container with docker compose restart portainer and read the token from the logs again.
To access Portainer without a tunnel, put a reverse proxy with a valid certificate in front of it. For the basics, see Set up a reverse proxy with nginx and Create an SSL certificate (Let's Encrypt).
The proxy must pass through WebSockets, or the container console and live logs won’t work. Here’s a server block for nginx:
server {
listen 80;
server_name portainer.example.com;
location / {
proxy_pass https://127.0.0.1:9443;
proxy_set_header Host $host;
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection "upgrade";
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Proto $scheme;
}
}
Then obtain the certificate with certbot --nginx -d portainer.example.com. Certbot will add HTTPS and redirect HTTP in the block. Portainer’s self-signed certificate won’t cause any issues; nginx doesn’t verify it between the proxy and the container.
Shorter with Caddy
If you use Caddy instead of nginx, the proxy obtains the certificate itself and passes through WebSockets automatically. Since Portainer uses HTTPS internally with its own certificate, the entry in the Caddyfile needs the tls_insecure_skip_verify option, as shown below.
portainer.example.com {
reverse_proxy https://127.0.0.1:9443 {
transport http {
tls_insecure_skip_verify
}
}
}
For more tips on securing your server, see Linux security tips.
Everything that belongs to Portainer itself is stored in the portainer_data volume: users, settings, environments, and your stacks’ Compose files. You have two options:
- In Portainer: Under Settings, in the Back up Portainer section, click Download backup to download a backup. You can also protect it with a password (Password protect).
- On the server: Briefly stop Portainer and archive the volume:
cd /opt/portainer
docker compose stop
docker run --rm -v portainer_data:/data -v "$(pwd)":/backup alpine tar -czf /backup/portainer-backup-$(date +%F).tar.gz -C /data .
docker compose start
This doesn’t include data from your other containers. Back up their volumes separately or also use your VPS backups in the web interface.
Here’s how to get the latest version in the lts channel:
cd /opt/portainer
docker compose pull
docker compose up -d
Back up the portainer_data volume first and read the release notes. If you’ve specified a fixed version, change the version number in docker-compose.yml first. Then remove old images with docker image prune.
After setup, select the local environment under Home. The sections for that environment then appear on the left, including Containers, Images, Volumes, Networks, and Stacks.
A stack is an application defined by a Compose file, just like one you’d start with docker compose:
- Open Stacks and click Add stack.
- Name the stack and select Web editor.
- Paste in the contents of your Compose file and click Deploy the stack.
Portainer saves the Compose file. Later, you can edit it in the stack and deploy the changes with Update the stack. If your Compose file is in a Git repository, you can also load the stack directly from there.
Under Containers, click a container to view its details. You’ll find Logs for the container output, Console for a shell inside the container, and Stats for CPU, RAM, and network usage, among other things. This is often the quickest way to narrow down an issue.
You can manage additional Docker servers using the Portainer Agent. In Portainer, go to Environments and add a new Docker Standalone environment with an agent. Portainer will show you the appropriate docker run command for the agent, which you’ll run on the other server. The agent listens on port 9001. On the other server, allow access to this port only from the IP address of your Portainer server, for example:
ufw allow from PORTAINER_SERVER_IP to any port 9001 proto tcp
Remember that Docker can also publish ports while bypassing ufw. The agent also has full access to the other server’s Docker socket.
- Edge Agents: The One-Click App only exposes the web interface through your domain, not the tunnel port
8000. So, you can only connect remote devices through Edge Agents with a tunnel when using the manual installation, with port8000opened as well. - Not a replacement for managing One-Click Apps: Install, update, and uninstall apps from the catalog in the dashboard, not in Portainer.
- Business features: Some features, such as scheduled backups or backups to S3, are only available in the paid Business Edition. This guide covers the Community Edition.
You’ve installed Portainer on your VPS, created the administrator account using the setup token, and learned why access to the Docker socket is so powerful. You can now conveniently manage containers, stacks, and logs in your browser, and connect additional servers through the Portainer Agent if needed.
Prefer not to manage Docker manually? Use the easy One-Click App method described above under “The easy way: Portainer as a One-Click App.”