Portainer is a free web interface for Docker. Instead of typing every docker command over SSH, you can see all containers, read their logs, restart them and deploy compose stacks from your browser. This guide installs Portainer Community Edition (CE) as a container and locks it down properly.
Before you start
- A Linux VPS with Docker and the Compose plugin installed (see Install Docker and Docker Compose).
- SSH access as root or a user in the
dockergroup. - Optional: a domain or subdomain (for example
portainer.example.com) pointing to the server if you want HTTPS through a reverse proxy.
Create the Portainer volume and container
- Connect to the server over SSH.
- Create a named volume so Portainer keeps its settings across updates:
docker volume create portainer_data - Start Portainer CE. Port 9443 serves the UI over HTTPS with a self-signed certificate:
docker run -d --name portainer --restart=always \ -p 9443:9443 \ -v /var/run/docker.sock:/var/run/docker.sock \ -v portainer_data:/data \ portainer/portainer-ce:lts - Check that it is running with
docker ps --filter name=portainer.
Warning: Portainer has full control of Docker through docker.sock, which is the same as root on the host. Never leave it open to the internet with a weak password.
Create the admin account
- Open
https://YOUR-SERVER-IP:9443in your browser and accept the self-signed certificate warning. - Create the admin user with a long, unique password. You must do this within a few minutes of starting the container, otherwise Portainer locks setup for security; run
docker restart portainerif that happens. - Choose Get Started to manage the local Docker environment.
Day-to-day tasks in Portainer
| Task | Where in Portainer |
|---|---|
| Start, stop, restart or remove a container | Containers → tick the container → action buttons |
| Read logs or open a shell | Containers → container name → Logs or Console |
| Deploy a docker compose file | Stacks → Add stack → paste the YAML → Deploy the stack |
| Pull a newer image and recreate | Container → Recreate → enable Re-pull image |
| Check volumes and free space | Volumes and Images (remove unused) |
Secure Portainer
- Restrict the port: allow 9443 only from your own IP in the firewall, or don't publish it at all and put Portainer behind a reverse proxy with SSL, such as Nginx Proxy Manager or Traefik.
- Mind UFW: Docker publishes ports past UFW rules by default. Read UFW and Docker bypass fix before relying on the firewall.
- Turn on two-factor: in My account, enable 2FA for the admin user.
Update Portainer
Settings live in the portainer_data volume, so updating is safe:
docker pull portainer/portainer-ce:lts
docker stop portainer && docker rm portainerThen run the same docker run command from above again.
Troubleshooting
- Page does not load: confirm the container is up, port 9443 is open in your firewall and you used
https://, nothttp://. - "New Portainer installation timed out": restart the container and create the admin user straight away.
- Permission denied on docker.sock: see Docker permission denied on the socket.
