Mad World #Save_GAZA: Free Palestine  

Search

How to Install Portainer with Docker (2026 Step-by-Step Guide)

How to Install Portainer with Docker (2026 Step-by-Step Guide)

Short answer: Portainer CE runs as one Docker container. On a Linux machine with Docker, create a volume with docker volume create portainer_data, then start Portainer with the docker run command in Step 2. Open https://your-server-ip:9443, paste the setup token that docker logs portainer prints, and create your admin user within 5 minutes. After that, you start containers and Docker Compose stacks from your browser.

We tested every step on 13 November 2026 with Portainer CE 2.45.3 LTS on Docker Engine 29.9.3, in a disposable lab. All the screenshots and command outputs below come from that test. Where you see localhost, use the IP address or the name of your own server.

What is Portainer?

Portainer is a web interface for Docker. Instead of typing docker commands, you see your containers, images, volumes and networks in your browser, and you start, stop, update and inspect them with a click. Portainer Community Edition (CE) is free and open source. Portainer also sells a Business Edition: in CE, its extra features show a "Business Feature" label.

Portainer itself is a container. It talks to Docker through the Docker socket, so it manages every container on the same machine, also the ones you started before you installed it.

What you need

  • A Linux machine (a server, a virtual machine, a mini PC or a NAS) with Docker Engine installed and running. No Docker yet? Follow our guide to install Docker and Docker Compose on Ubuntu. New to containers? Start with Docker for beginners.
  • A terminal on that machine, with a user in the docker group or sudo rights. If your user is not in the docker group, put sudo in front of every docker command below.
  • Port 9443 free on the machine. Port 8000 is only for Edge Agents, so you can leave it out.
  • A browser on a computer that can reach the machine.

Step 1: Create a volume for Portainer's data

Portainer keeps its database (your admin user, your settings and your environments) in the /data folder of its container. Put that folder in a named Docker volume, so that it survives updates:

Terminal
docker volume create portainer_data

Docker answers with the name of the new volume:

Code
portainer_data

Step 2: Start the Portainer container

This is the command from the official Portainer documentation, for the long-term support (LTS) version:

Terminal
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 portainer/portainer-ce:lts

What each part does:

  • -p 9443:9443: the web interface, over HTTPS.
  • -p 8000:8000: a tunnel for Edge Agents only. If you manage only this machine, you can remove it.
  • --restart=always: Docker starts Portainer again after a reboot or a crash.
  • -v /var/run/docker.sock:/var/run/docker.sock: gives Portainer control of Docker on this machine. This is full control, so never open Portainer to the internet (see Keep Portainer safe).
  • -v portainer_data:/data: the volume from Step 1.
  • portainer/portainer-ce:lts: the Community Edition image, LTS channel. On the day of our test, the lts, sts and latest tags all pointed to the same image, version 2.45.3.

The first time, Docker downloads the image, then prints the ID of the new container. Check that the container runs:

Terminal
docker ps
Code
CONTAINER ID   IMAGE                        COMMAND        CREATED         STATUS         PORTS                                                                                                NAMES
e9c8e2f965b6   portainer/portainer-ce:lts   "/portainer"   6 seconds ago   Up 4 seconds   0.0.0.0:8000->8000/tcp, [::]:8000->8000/tcp, 0.0.0.0:9443->9443/tcp, [::]:9443->9443/tcp, 9000/tcp   portainer

The STATUS column must start with Up. The 9000/tcp without an arrow is the old HTTP port: Portainer still listens on it inside the container, but the command does not publish it. Use port 9443.

Step 3: Get the setup token

Since versions 2.43 and 2.39.4, a new Portainer instance asks for a one-time setup token before anyone can create the admin user. The token stops a stranger who reaches your new instance first from taking it over. Portainer prints the token in its log:

Terminal
docker logs portainer

Near the end of the log, you see this block. Your token is a string of 64 letters and digits.

Code
==========================

setup_token=<your 64-character token>

Paste it into the setup screen, or send it in the X-Setup-Token header.
Start with --no-setup-token to disable.

========================== |

To see only the token line, run the command below. Portainer writes its log to the error stream, so the 2>&1 part is necessary: without it, grep finds nothing.

Terminal
docker logs portainer 2>&1 | grep setup_token

Copy the 64 characters after setup_token=. If Portainer restarts before you create the admin user, it prints a new token. Always use the last token in the log.

Step 4: Open Portainer and create the admin user

In your browser, open https://your-server-ip:9443 (on the machine itself: https://localhost:9443). Portainer uses a self-signed certificate, so the browser says that the connection is not private. This is normal for a new install: click Advanced, then continue to the site.

Portainer first-run page with the Username, Password and Setup token fields and the Create user button
The first page of a new Portainer: username (1), password (2), setup token (3), then Create user (4).
  1. Username: admin is already there. You can change it.
  2. Password and Confirm password: at least 12 characters. Keep it in your password manager: Portainer has no default password.
  3. Setup token: paste the token from Step 3.
  4. Click Create user.

Do it within 5 minutes. If nobody creates the admin user within 5 minutes of the start, Portainer locks itself for safety. We let it happen in our test, and the browser showed this page:

Portainer page saying that the instance timed out for security purposes
A new Portainer locks itself when nobody creates the admin user within 5 minutes.

Restart the container, read the new token, and go back to the setup page:

Terminal
docker restart portainer
docker logs portainer 2>&1 | grep setup_token

After the restart, our log had a second, different token, and the setup page was back.

Step 5: Skip Edge Compute and finish the quick setup

Portainer 2.45 then offers to set up Edge Compute, a feature to manage remote devices. You do not need it to manage Docker on this machine. Click Skip:

Portainer Set up Edge Compute page with the Skip button
Edge Compute is for remote devices: click Skip (1).

On the Quick Setup page, Portainer has already found the Docker engine it runs on. Click Get Started to use it:

Portainer Quick Setup page with the Get Started option
Get Started (1) connects Portainer to the Docker engine on the same machine.

You land on the Home page. Your machine is the local environment, with its state, its Docker version and its number of containers:

Portainer Home page with the local environment, Up, Standalone Docker 29.9.3
The local environment (1): Up, Docker 29.9.3, reached through /var/run/docker.sock.

Step 6: Open the dashboard

Click local. The dashboard counts your stacks, containers, images, volumes and networks. On a new install, the only container is Portainer itself. The menu on the left opens each list.

Portainer dashboard of the local environment with the counts of stacks, containers, images, volumes and networks
The dashboard of the local environment, with the menu on the left.

Step 7: Run your first container from Portainer

Now start a small web server (nginx) without a docker run command. In the left menu, open Containers, then click Add container:

Portainer container list with the Add container button
The Add container button (1) is above the container list.

Fill in the form:

Portainer Create container form with the name hello-nginx, the image nginx:latest and port 8080 mapped to port 80
Name (1), image (2), host port (3), container port (4), then Deploy the container (5).
  1. Name: hello-nginx.
  2. Image: nginx:latest. Keep Always pull the image on, so Portainer downloads the newest version.
  3. Under Port mapping, click Map additional port, then type 8080 in the Host box.
  4. Type 80 in the Container box and keep TCP.
  5. Click Deploy the container.

This form does the same as docker run -d --name hello-nginx -p 8080:80 nginx:latest. A few seconds later, Portainer shows the container list: hello-nginx is running, and its published port is 8080:80.

Portainer container list with hello-nginx running and the published port 8080:80
hello-nginx (1) is running (2), on port 8080 (3).

Open http://your-server-ip:8080. You see the nginx welcome page:

Browser with the Welcome to nginx! page on port 8080
The new container answers on port 8080.

In the same list, you can stop, restart or remove a container. The small icons under Quick Actions open its logs, its details, its live stats and a console. The logs view works like docker logs -f: see how to follow container logs.

Step 8: Deploy a stack (Docker Compose) from Portainer

A stack is a Docker Compose file that Portainer runs for you. As an example, we deploy Uptime Kuma, a free monitoring tool. In the left menu, open Stacks, click Add stack, then:

  1. Type a Name in lowercase: uptime-kuma.
  2. Keep Web editor and paste this Compose file:
YAML
services:
  uptime-kuma:
    image: louislam/uptime-kuma:2
    container_name: uptime-kuma
    restart: unless-stopped
    ports:
      - "3001:3001"
    volumes:
      - uptime-kuma:/app/data

volumes:
  uptime-kuma:
Portainer Create stack page with the name uptime-kuma and a Compose file in the web editor
The stack name (1) and the Compose file in the web editor (2).

Scroll down and click Deploy the stack:

Deploy the stack button at the bottom of the Portainer Create stack page
Deploy the stack (1) is at the bottom of the page.

Portainer downloads the image and starts the container. In our test, the container showed starting first, then healthy a few minutes later:

Portainer container list with the uptime-kuma container healthy on port 3001
The stack's container (1) is healthy (2), on port 3001 (3).

Open http://your-server-ip:3001 to create your Uptime Kuma account. Our Uptime Kuma guide shows the next steps. To learn what Portainer does behind this button, see docker compose up.

Install Portainer with Docker Compose instead

If you prefer Compose, Portainer publishes a ready file. Download it and start it:

Terminal
curl -L https://downloads.portainer.io/ce-lts/portainer-compose.yaml -o portainer-compose.yaml
docker compose -f portainer-compose.yaml up -d

The file contains:

YAML
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:
      - 9443:9443
      - 8000:8000  # Remove if you do not intend to use Edge Agents

volumes:
  portainer_data:
    name: portainer_data

networks:
  default:
    name: portainer_network

We ran it on a second, empty Docker engine (Docker Compose v5.7.1):

Terminal
$ docker compose -f portainer-compose.yaml up -d
 Image portainer/portainer-ce:lts Pulling 
 Image portainer/portainer-ce:lts Pulled 
 Network portainer_network Creating 
 Volume portainer_data Creating 
 Volume portainer_data Created 
 Network portainer_network Created 
 Container portainer Creating 
 Container portainer Created 
 Container portainer Starting 
 Container portainer Started

Portainer 2.45.3 started and printed a setup token, as in Step 3. Then continue with Step 4. The volume has the same name as in Step 1. The Portainer documentation links the STS file (ce-sts in the address), which uses the sts tag; ce-lts gives the LTS file above.

Install Portainer on a Synology NAS

A Synology NAS runs Docker through the Container Manager package, so the same commands work there. We did not repeat this part on a Synology for this update, so check each screen on your model:

  1. Install Container Manager from Package Center. Before DSM 7.2, the package is called Docker.
  2. Turn on SSH and connect as an administrator: see how to SSH into your Synology.
  3. Run the commands of Step 1 and Step 2 with sudo in front.
  4. Open https://your-nas-ip:9443 and continue with Step 3 (sudo docker logs portainer 2>&1 | grep setup_token).

Container Manager keeps working: Portainer is a second view of the same containers. To update containers the Synology way, see how to update a Docker container on Synology.

How to update Portainer

Your users, settings and stacks are in the portainer_data volume, not in the container. To update, you replace the container and keep the volume. Make a backup first: in Portainer, open Settings, go to Back up Portainer and click Download backup. The file holds the Portainer configuration, not your containers.

Then run these four commands. The last one is the command of Step 2:

Terminal
docker stop portainer
docker rm portainer
docker pull portainer/portainer-ce:lts
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 portainer/portainer-ce:lts

Our output. Our image was already the newest, so the pull said "up to date":

Terminal
$ docker stop portainer
portainer
$ docker rm portainer
portainer
$ docker pull portainer/portainer-ce:lts
lts: Pulling from portainer/portainer-ce
Digest: sha256:3609c307943bca8e5c492f69ddd6965df177208b50678a4cff28391c8dd4e96e
Status: Image is up to date for portainer/portainer-ce:lts
docker.io/portainer/portainer-ce:lts
$ 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 portainer/portainer-ce:lts
d56ee0659b9f…

We then logged in with the same admin user, and hello-nginx and the uptime-kuma stack were still there. Portainer asked for no token, because the instance already had an admin. While Portainer is stopped, your other containers keep running.

If you installed Portainer with Compose, update it from the folder of the Compose file:

Terminal
docker compose -f portainer-compose.yaml pull
docker compose -f portainer-compose.yaml up -d
Terminal
$ docker compose -f portainer-compose.yaml pull
 Image portainer/portainer-ce:lts Pulling 
 Image portainer/portainer-ce:lts Pulled 
$ docker compose -f portainer-compose.yaml up -d
 Container portainer Running

When a newer image exists, the up -d command replaces the container. In our test, the image was the newest, so the container stayed as it was ("Running").

How to uninstall Portainer

Terminal
docker stop portainer
docker rm portainer
docker volume rm portainer_data

The last command deletes Portainer's users and settings for good. Skip it if you may come back. Your other containers are not touched. Our output, with a check at the end:

Terminal
$ docker stop portainer
portainer
$ docker rm portainer
portainer
$ docker volume rm portainer_data
portainer_data
$ docker ps --format 'table {{.Names}}\t{{.Status}}'
NAMES         STATUS
uptime-kuma   Up 9 minutes (healthy)
hello-nginx   Up 16 minutes

Keep Portainer safe

  • Do not open ports 9443, 9000 or 8000 to the internet on your router. A person who gets into Portainer controls every container and, through the Docker socket, the machine itself.
  • To use Portainer away from home, connect through a VPN, or put it behind a Cloudflare Tunnel with a login page in front: see how to create a Cloudflare Tunnel on Synology. If you use Nginx Proxy Manager, see how to keep the real visitor IP.
  • Use a long, unique admin password, and update Portainer regularly.

Troubleshooting

"Your Portainer instance timed out for security purposes"

Nobody created the admin user within 5 minutes of the start. Run docker restart portainer, read the new token, and finish Step 4 right away.

The setup token is refused

You probably used an old token: each start prints a new one. Run docker logs portainer 2>&1 | grep setup_token, take the last line, and copy only the 64 characters after setup_token=.

grep shows nothing

Add 2>&1 before the pipe. Portainer writes its log to the error stream, and a pipe passes only the normal output.

The page does not open

Use https://, not http://, and port 9443. Check that docker ps shows 0.0.0.0:9443->9443/tcp. If the machine has a firewall, allow the port. On Ubuntu with ufw: sudo ufw allow 9443/tcp.

"port is already allocated"

Another program uses port 8000 or 9443. If you do not use Edge Agents, remove -p 8000:8000. For the interface, publish another host port, for example -p 9444:9443, and open https://your-server-ip:9444.

Frequently asked questions

Is Portainer free?

Portainer Community Edition is free and open source. The menus with a "Business Feature" label need the paid Business Edition. Everything in this guide works in CE.

What is the default Portainer username and password?

There is no default password. On the first visit, you create the admin user yourself. The username box starts with admin, and the password needs at least 12 characters.

Which port does Portainer use?

Port 9443 for the web interface, over HTTPS. Port 8000 is the tunnel for Edge Agents. Port 9000 is the old HTTP port: the current install command does not publish it.

Should I use the lts or the sts tag?

Use lts (long-term support) on a home server: it gets fixes for longer. sts (short-term support) gets new features first. On 13 November 2026, both tags pointed to version 2.45.3.

Does removing Portainer remove my containers?

No. Portainer only manages Docker. In our test, hello-nginx and Uptime Kuma kept running after we removed the Portainer container and its volume.

Can I install Portainer without the setup token?

Yes: start it with --no-setup-token, or set the admin password at start with --admin-password-file. Portainer advises --no-setup-token only on a network that you fully control. The token step takes one minute, so keep it.

Sources

Tags:
Yassine

Yassine

Yassine founded IGProd to educate the visitors with technological tutorials. These helpful guides are available for all sorts of professionals and novices, whether they work in technology or not!

Surf freely 💗

Leave a comment

Your email address will not be published. Required fields are marked *

Your experience on this site will be improved by allowing cookies Cookie Policy