On this page
- What is Portainer and when is it useful?
- What do you need before installing?
- How do you install Portainer CE?
- How do you open the interface safely?
- What happens on first login?
- How do you deploy a stack from Portainer?
- How do you manage more than one server?
- How do you upgrade Portainer without losing settings?
- What should you check when something goes wrong?
- Questions
What is Portainer and when is it useful?
Portainer is a web interface for Docker that shows containers, images, volumes, networks and Compose stacks, and lets you start, stop, inspect and redeploy them with a few clicks. It is handy when several people share a server, when you want to read container logs from a phone, or when you are learning Docker and prefer to see what each command changes. It does not replace the command line; everything it does maps to normal Docker API calls, and you can mix both freely.
The Community Edition is open source and free. A separate Business Edition adds features such as role based access control, which this guide does not cover.
What do you need before installing?
You need a server with Docker Engine running and a sudo user. Install Docker with the Docker Engine tutorial, or deploy the Docker image on Ubuntu 24.04 where it is already present. Portainer itself is light: the container usually sits well under 100 MB of memory, so even a 1 GB plan leaves room for real workloads. Check the engine first:
docker version --format '{{.Server.Version}}'
sudo systemctl is-active dockerHow do you install Portainer CE?
Create a named volume for its database, then start the container. Binding the HTTPS port to 127.0.0.1 keeps the interface off the public internet from the very first second:
sudo docker volume create portainer_data
sudo docker run -d --name portainer --restart=always \
-p 127.0.0.1:9443:9443 \
-v /var/run/docker.sock:/var/run/docker.sock \
-v portainer_data:/data \
portainer/portainer-ce:ltsThe lts tag follows the long term support line; an sts tag tracks the faster short term releases. Port 8000 only matters for remote Edge agents, so it is left out here. Confirm it is running and listening:
sudo docker ps --filter name=portainer
sudo ss -tlnp | grep 9443How do you open the interface safely?
Use an SSH tunnel for personal access. From your own computer, forward a local port to the loopback port on the server:
ssh -L 9443:127.0.0.1:9443 deploy@198.51.100.24Then browse to https://localhost:9443. Portainer uses a self signed certificate, so the browser warns once; that is expected. If you would rather reach it by name, place a reverse proxy before the app and point a subdomain such as portainer.example.net at the server with an A record (see DNS records). With Caddy the whole site block is short:
portainer.example.net {
reverse_proxy https://127.0.0.1:9443 {
transport http {
tls_insecure_skip_verify
}
}
}The Caddy HTTPS tutorial explains installing Caddy and getting the certificate. Only ports 80 and 443 then need to be open in ufw.
What happens on first login?
The first visitor creates the administrator account, and you have about five minutes after the container starts to do it. After that window Portainer locks setup as a safety measure. If you miss it, restart the container with sudo docker restart portainer and open the page again. Choose a password of at least twelve characters. On the next screen pick the local environment, which uses the mounted Docker socket, and you will see the dashboard with counts of containers, images and volumes.
How do you deploy a stack from Portainer?
Open Stacks, choose Add stack, paste a Compose file into the web editor, and press Deploy. The format is the same as on the command line, described in the Docker Compose guide. Environment variables can be entered in the form below the editor instead of a separate file. Stacks can also be pulled from a Git repository, and Portainer can poll that repository or accept a webhook to redeploy when it changes, which gives a light GitOps workflow without a full CI system.
Stacks created in Portainer are stored in its volume under /data/compose. If you later want to manage one from the shell, export the file first so both tools agree on the definition.
How do you manage more than one server?
Install the Portainer Agent on each extra Docker host and add it as an environment. The agent listens on TCP 9001, which should only accept connections from the main Portainer server:
sudo docker run -d --name portainer_agent --restart=always \
-p 9001:9001 \
-v /var/run/docker.sock:/var/run/docker.sock \
-v /var/lib/docker/volumes:/var/lib/docker/volumes \
portainer/agent:ltsBecause Docker published ports bypass ufw input rules, restrict 9001 in the DOCKER-USER chain or publish it only on an address you control. For multi host setups also look at Docker Swarm, which Portainer can manage as one environment.
How do you upgrade Portainer without losing settings?
Settings, users and stack files live in the portainer_data volume, so upgrading means replacing the container only:
sudo docker stop portainer
sudo docker rm portainer
sudo docker pull portainer/portainer-ce:lts
sudo docker run -d --name portainer --restart=always \
-p 127.0.0.1:9443:9443 \
-v /var/run/docker.sock:/var/run/docker.sock \
-v portainer_data:/data \
portainer/portainer-ce:ltsBack up the volume before major upgrades, for example with sudo tar czf portainer-data.tgz -C /var/lib/docker/volumes/portainer_data _data while the container is stopped.
What should you check when something goes wrong?
Start with sudo docker logs portainer. A message about the admin timeout means the five minute setup window passed. A blank or refused page through the tunnel usually means the container is not listening on the port you forwarded; check with ss -tlnp. If environments show as down, the Docker socket mount is missing or the agent port is blocked. Errors about an unsupported API version after a Docker Engine upgrade are fixed by pulling the current Portainer image.
Plans that fit this guide
Base city prices. Every plan includes a dedicated IPv4 address, IPv6, full root and all 18 images.
Questions about Portainer CE web UI
Is Portainer CE free?
Yes. The Community Edition is open source and has no node limit. The paid edition adds team and access control features.
Does Portainer need root access?
It needs the Docker socket, which is equivalent to root on the host. Protect the admin login and keep the interface private.
Can I use Portainer with Podman?
Portainer can connect to the Podman socket, though Docker is the main target. See the Podman guide for enabling the socket.
Should I open port 9443 in the firewall?
Avoid it. Use an SSH tunnel or a reverse proxy on 443 with a real certificate instead of exposing the admin port directly.
Will deleting the Portainer container delete my apps?
No. Containers you manage keep running. Removing the portainer_data volume only resets Portainer itself.
More in Containers and PaaS
- Docker Compose stacks
- Docker volumes and bind mounts
- Read and limit Docker logs
- Free disk space used by Docker
- Build, tag and push Docker images
- Run and manage containers
- Podman and rootless containers
- Docker Swarm across servers
- Automatic updates with Watchtower
- Dokploy self-hosted PaaS
- CapRover PaaS
- Dokku git push deploys
- Coolify on your own server