Portainer on a VPS: Visual Docker Container Management, Stacks, and Multi-Host Control
Portainer is a lightweight web UI for managing Docker environments — deploy containers, manage Docker Compose stacks, inspect volumes and networks, view real-time logs and stats, and manage users and access controls, all from a browser without typing Docker commands. It complements Coolify and Dokploy (which focus on application deployment) by providing lower-level Docker management for any container environment.
Portainer vs Coolify vs Dokploy
- Portainer: Visual Docker management UI — manages existing containers, stacks, images, volumes. Does not automate deployment from git.
- Coolify/Dokploy: Application deployment platforms — git push → deploy. Higher-level abstraction, manages Nginx/SSL automatically.
- Best together: Use Coolify for application deployments, Portainer for inspecting the underlying Docker environment, troubleshooting containers, and managing standalone services.
Step 1: Install Portainer
<code"># Create a Docker volume for Portainer data (survives container restarts) docker volume create portainer_data # Run Portainer CE (Community Edition — free) docker run -d \ --name portainer \ --restart always \ -p 127.0.0.1:9000:9000 \ -v /var/run/docker.sock:/var/run/docker.sock \ -v portainer_data:/data \ portainer/portainer-ce:latest docker ps | grep portainer
Step 2: Nginx Reverse Proxy
<code">sudo nano /etc/nginx/sites-available/portainer
<code">server {
listen 80;
server_name docker.yourdomain.com;
return 301 https://$host$request_uri;
}
server {
listen 443 ssl http2;
server_name docker.yourdomain.com;
ssl_certificate /etc/letsencrypt/live/docker.yourdomain.com/fullchain.pem;
ssl_certificate_key /etc/letsencrypt/live/docker.yourdomain.com/privkey.pem;
location / {
proxy_pass http://127.0.0.1:9000;
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection 'upgrade';
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Proto $scheme;
proxy_read_timeout 120s;
}
}
<code">sudo ln -s /etc/nginx/sites-available/portainer /etc/nginx/sites-enabled/ sudo nginx -t && sudo systemctl reload nginx sudo certbot --nginx -d docker.yourdomain.com
Step 3: Initial Setup
- Visit
https://docker.yourdomain.com - Create admin username and password (you have 5 minutes before Portainer locks the setup page)
- Select environment: Docker Standalone → Connect
- You’re in the Portainer dashboard
Key Portainer Features
Deploy a Stack (Docker Compose via UI)
- Stacks → Add stack
- Name:
myapp - Paste your
docker-compose.ymlcontent in the Web editor - Add environment variables in the “Environment variables” section
- Deploy the stack
Portainer shows all containers in the stack, their status, logs, and resource usage.
Container Operations
- Containers → select a container
- Logs: Real-time log tail with search and filtering
- Stats: Live CPU, RAM, network, and disk I/O graphs
- Console: Browser-based terminal into the running container (
docker execvia UI) - Inspect: Full container configuration JSON
Image Management
- Images → lists all pulled images with size and creation date
- Pull a new image: enter image name and tag
- Prune unused images: removes dangling images to free disk space
Volume and Network Management
<code"># Portainer UI shows: # Volumes: which containers use each volume, when created, size # Networks: which containers are on each network, subnet, gateway # Both can be created, inspected, and removed via the UI
Step 4: User Management and Teams
- Settings → Users → Add user
- Assign roles: Administrator (full access) or Standard User (restricted)
- Teams → create teams (e.g., “Developers”, “Operations”)
- Assign teams to specific environments with role-based access
Standard users see only their authorized environments and cannot access system-level Docker operations.
Step 5: Connect Multiple Docker Hosts
Portainer can manage Docker on remote VPS instances without installing Portainer on each one:
<code"># On the REMOTE VPS — install Portainer Agent docker run -d \ --name portainer_agent \ --restart always \ -v /var/run/docker.sock:/var/run/docker.sock \ -v /var/lib/docker/volumes:/var/lib/docker/volumes \ -p 9001:9001 \ portainer/agent:latest # In Portainer UI on main server: # Environments → Add environment → Docker Standalone # Select "Agent" connection type # Enter: remote-vps-ip:9001
Step 6: Portainer Webhooks for Auto-Deploy
<code"># Portainer can redeploy a stack when a new image is pushed # 1. Stack → select stack → Webhooks → Enable webhook # 2. Copy the webhook URL # 3. In your CI pipeline, after pushing a new image: curl -X POST "https://docker.yourdomain.com/api/webhooks/YOUR_WEBHOOK_TOKEN" # Portainer pulls the new image and recreates affected services
Portainer Resource Limits per Container
<code"># In Portainer, when deploying a container:
# Resources → set CPU and Memory limits
# Equivalent to Docker --memory and --cpus flags
# Or via stack deploy with resource limits:
services:
myapp:
image: myimage:latest
deploy:
resources:
limits:
cpus: '0.50'
memory: 512M
reservations:
memory: 256M
Getting Started
Portainer uses only 50–100 MB RAM and runs alongside any other services on a KVM VPS at VPS.DO. It’s particularly valuable when you have multiple Docker Compose stacks on a server and want to inspect, restart, or view logs without SSH access. The multi-host management feature is ideal for teams managing several VPS instances — all visible and manageable from one Portainer dashboard.
Conclusion
Portainer provides a clear visual interface for Docker management that complements command-line Docker workflows. Container logs, stats, and console access through a browser are valuable for debugging; stack management makes deploying Docker Compose applications accessible to team members without Docker CLI expertise; and multi-host management gives operations teams a single pane of glass for all their Docker environments. At 50 MB RAM and free Community Edition, it’s one of the easiest wins for VPS Docker management.