How to install Portainer (in Docker)
Goal: run Portainer CE in Docker with persistent data, then log in to the UI.
Prerequisites
- Docker installed (see Docker guide)
- A host with a stable IP/DNS name
Step 1 — Create a Docker volume for Portainer data
docker volume create portainer_data
Step 2 — Run Portainer CE
Portainer needs access to the Docker socket to manage the local engine.
docker run -d \
--name portainer \
--restart=always \
-p 8000:8000 \
-p 9443:9443 \
-v /var/run/docker.sock:/var/run/docker.sock \
-v portainer_data:/data \
portainer/portainer-ce:latest
Verify
docker ps --filter name=portainer
docker logs --tail 50 portainer
Step 3 — Access the web UI
Open:
https://<host-ip>:9443
Accept the certificate warning (self-signed by default).
Step 4 — First-time setup
In Portainer:
- Create the initial admin user
- Select Get Started
- Choose the local environment (Docker)
Optional — Harden access (recommended)
- Put Portainer behind your reverse proxy (TLS + auth)
- Restrict access to your management VLAN
- Don’t expose it directly to the Internet
Troubleshooting
- Portainer won’t start
- Check
docker logs portainerfor port conflicts or permission issues.
- Check
- UI loads but can’t see containers
- Confirm the socket mount exists:
/var/run/docker.sock:/var/run/docker.sock.
- Confirm the socket mount exists:
Next steps
- Install Pi-hole in Docker (see guide)
- Add other stacks via “Stacks” (Compose) in Portainer