How to Install Portainer (Manage Docker from a Web Page)

Once a server has ten containers, docker ps output stops fitting on the screen. Portainer gives you a web page listing everything: what's running, how much CPU and memory each uses, logs with a click, restart and update buttons, and a shell into any container without touching SSH. It's handy for you and essential if someone less technical needs to restart Jellyfin.
Quick reference
| Task | What |
|---|---|
| Folder | ~/docker/portainer/compose.yaml |
| Visit | https://server-ip:9443 |
| Containers | Containers — logs, stats, console, restart |
| Deploy a compose file | Stacks → Add stack |
| Clean up | Images → Unused |
1. The compose file
mkdir -p ~/docker/portainer && cd ~/docker/portainer
nano compose.yaml
services:
portainer:
image: portainer/portainer-ce:latest
container_name: portainer
ports:
- "9443:9443"
volumes:
- /var/run/docker.sock:/var/run/docker.sock
- ./data:/data
restart: unless-stopped
The docker.sock mount is what lets Portainer control Docker. It's the same as giving the container root on the host, so treat Portainer's login like a root password.
docker compose up -d
sudo ufw allow from 192.168.1.0/24 to any port 9443
(Allowing only your network is deliberate — don't put this on the internet.)
2. First run
Open https://192.168.1.50:9443. The browser warns about the self-signed certificate; accept it. Create the admin user within five minutes of starting the container — after that it locks itself and you need docker compose restart. Choose Get started to manage the local Docker.
3. What you'll use
- Containers — the list. Click one for Logs, Stats (live CPU/RAM graphs), Console (a shell inside it) and Recreate (pull the latest image and restart with the same settings).
- Images — click Unused to remove old ones and recover disk space.
- Volumes — see which data volumes exist and which container uses each.
- Stacks — Portainer's name for compose files.
4. Deploy a compose file as a stack
Stacks → Add stack, give it a name, paste a compose file into the editor, Deploy. It's the same as docker compose up -d but with a form, and you can edit and redeploy from the browser. Stacks you created on the command line show as "Limited" — Portainer can see them but won't edit them, which is fine.
5. Add another server
If you have a second machine (a Pi, say), Environments → Add → Docker Standalone → Agent gives you a one-line command to run there, and both servers appear in one Portainer.
Troubleshooting
"Your Portainer instance timed out for security purposes." You took more than five minutes to create the admin user. docker compose restart portainer and try again.
Can't reach 9443. Firewall rule missing, or you typed http:// — it must be https://.
Containers show but can't be controlled. The docker.sock mount is missing or Portainer isn't allowed to use it. Check ls -l /var/run/docker.sock.
Update Portainer itself. docker compose pull && docker compose up -d in its folder. Updating it from inside itself works too but is slightly odd.
Wrapping up
One container with the Docker socket, a login created within five minutes, and your whole Docker setup is a web page. Keep it on the local network only, and give family members their own user if they need to restart things.
