Portainer on a VPS: Visual Docker Container Management, Stacks, and Multi-Host Control

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

  1. Visit https://docker.yourdomain.com
  2. Create admin username and password (you have 5 minutes before Portainer locks the setup page)
  3. Select environment: Docker Standalone → Connect
  4. You’re in the Portainer dashboard

Key Portainer Features

Deploy a Stack (Docker Compose via UI)

  1. Stacks → Add stack
  2. Name: myapp
  3. Paste your docker-compose.yml content in the Web editor
  4. Add environment variables in the “Environment variables” section
  5. Deploy the stack

Portainer shows all containers in the stack, their status, logs, and resource usage.

Container Operations

  1. Containers → select a container
  2. Logs: Real-time log tail with search and filtering
  3. Stats: Live CPU, RAM, network, and disk I/O graphs
  4. Console: Browser-based terminal into the running container (docker exec via UI)
  5. Inspect: Full container configuration JSON

Image Management

  1. Images → lists all pulled images with size and creation date
  2. Pull a new image: enter image name and tag
  3. 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

  1. Settings → Users → Add user
  2. Assign roles: Administrator (full access) or Standard User (restricted)
  3. Teams → create teams (e.g., “Developers”, “Operations”)
  4. 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.

Fast • Reliable • Affordable VPS - DO It Now!

Get top VPS hosting with VPS.DO’s fast, low-cost plans. Try risk-free with our 7-day no-questions-asked refund and start today!