Mar 11, 2025 · Linux & Servers / Beginner · ~3 MIN READ
How to Use Portainer to Manage Docker Containers
Use Portainer as a visual management layer on top of Docker Compose, without losing the underlying fundamentals.
Who This Is For
Beginner. Best after you’ve already deployed at least one stack via Compose.
Think of it like a car’s dashboard instead of popping the hood every time you want to know what’s going on. The engine (Docker) works the same either way, the dashboard just gives you dials and switches instead of squinting at the wiring directly.
What You’ll Build
A Portainer dashboard managing at least two Docker Compose stacks, without losing the underlying command-line fundamentals.
Prerequisites
- Docker host with at least one running Compose stack
- A browser
Deploy Portainer
$ docker volume create portainer_data
$ docker run -d -p 9443:9443 --name portainer --restart=always \
$ -v /var/run/docker.sock:/var/run/docker.sock \
$ -v portainer_data:/data portainer/portainer-ce:latest
Secure the First Admin Account
On first login, set a strong administrator password immediately, this account has full control over every container on the host.
Interface Tour
- Containers, start, stop, restart, view logs, open a console
- Images, see what’s pulled and prune unused ones
- Volumes, inspect and (carefully) remove unused volumes
- Stacks, deploy and manage Compose files directly from the UI
Deploy a Stack from Compose
Stacks → Add stack → paste your compose.yaml content (or point at a Git repo) → Deploy.
Recreate and Clean Up Safely
Recreating a container from the UI is equivalent to docker compose up -d --force-recreate, safe as long as the underlying volumes are untouched. Removing unused images/volumes is safe; removing a volume attached to a running app is not.
Security & Backup Notes
- The Docker socket gives whoever controls it root-equivalent access to the host, treat the Portainer admin account like a root password
- Do not expose the Portainer web UI directly to the internet
- Prefer Compose-first, Portainer-second: define stacks as files in version control, use Portainer to observe and operate them
Troubleshooting
- Portainer can’t reach Docker, confirm the socket was mounted correctly in the run command
- Docker socket permission issue, the container needs the socket mounted, not a copy of it
- Accidentally deleted a persistent volume, this is why backups exist; see the Restic article
- Recreating a container without understanding its mounts, always check the Volumes tab before recreating anything with named volumes you don’t recognize
Lab Finish Line
A Portainer dashboard managing at least two Docker Compose stacks.