Skip to main content
Servers Are Up
Virtual Datacenter
PricingFree Tools
Sign inBrowse catalog
Servers Are Up
Virtual Datacenter
PricingFree Tools
Sign inBrowse catalog

Loading…

Servers Are Up

Your apps, automation and data on hardware we own. Build a private stack with predictable capacity and access through your dashboard, API or SSH.

SLA with service creditsOwned hardwareUS-based

Make room for your next idea

Explore the capacity, apps and access options that fit your workload. Check current availability and your total before you buy.

Sign up freeView Pricing

Products

  • Linux VPS
  • Windows VPS
  • Cloud & SaaS Services
  • Cloud Storage (Azure)
  • Virtual Datacenter
  • AI & Agent Hosting
  • Containers
  • Instant Apps
  • Software Platforms
  • Network builder
  • Game Servers
  • Pricing

Resources

  • Free Network Tools
  • 2026 Pricing Benchmark
  • Live SVG Badges
  • Latency & Speed Test
  • Guides & Tutorials
  • Documentation
  • API Reference
  • MCP Server
  • CLI & SDKs
  • OpenAPI & llms.txt
  • Use Cases
  • Free Migration
  • Uptime & Reliability
  • Datacenter
  • System Status
  • Network
  • Provider Comparisons Hub
  • Compare Providers

Company

  • About Us
  • Enterprise
  • Security Architecture
  • Trust Center
  • Blog
  • FAQ
  • Compliance
  • Startup Program
  • Open-Source Sponsorship
  • Press & Media Kit
  • Referral Program
  • Help Center
  • Contact Us
© Servers Are Up
TermsPrivacySLARefund PolicyDPAAcceptable Use
Service information
Docs
  • Documentation Hub
  • Choose a Product
    VMs, Containers & Cloud
  • First Linux Server
    SSH, Firewall & Apps
  • Windows Server 2025
    BYOL & Remote Desktop
  • Remote Access
  • Troubleshooting
  • FAQ
  • All Product Guides
    29 Step-by-Step Guides
  • Cloud & SaaS Catalog
    112 Cloud & SaaS Offerings
  • Azure Cloud Storage
    Hot/Cool/Archive & WORM
  • Resource Manager & RBAC
    Groups, Tags & Locks
  • Multi-Model Cloud DB
    JSONB, SQL & pgvector
  • Cloud Identity & ZTNA
    OIDC, SCIM & PIM
  • Key Vault & KMS
    Secrets & Envelope Keys
  • Cloud SIEM, SOAR & DLP
    Posture & Threat Response
  • API Gateway & Cloud DNS
    Edge WAF & DNS Zones
  • Serverless, Workflows & IoT
    Functions, Queues & DAGs
  • SaaS, Governance & Vault
    Budgets & Off-Host GRS
  • Build Web Apps with AI
  • Next.js and React
  • TypeScript and Node.js
  • npm and Tooling
  • Data and APIs
  • Deploy and Operate
  • Tutorials
  • Infrastructure
  • Automation & Regions
  • API Overview
  • API v1 Reference
    Endpoints & 23 Scopes
  • MCP Server
    129 AI Agent Tools
  • Swagger / OpenAPI 3.1
  • API Playground
  • Versioning & Sunset
  • API Token Security
    Authentication & Tokens
  • Instances API
    Compute Resources
  • Networking API
    Networks & Ports
  • Storage API Availability
    Volumes & Backups
  • Webhooks & Events
    Event Notifications
  • Rate Limits & Best Practices
    Throttling & Retries
  • sau CLI Reference
    34 Commands (v0.2)
  • Browser Web CLI
  • SDKs
  • Infrastructure as Code
    Terraform & Ansible
  • Code Examples
  • CLI & SDK Guides
  • Security Guides
  • Security at a Glance
  • Zero Trust Architecture
  • Live Trust Center
  • Compliance
Need help?

Loading documentation...

Documentation/products

Run your first Docker Compose stack on Managed Docker

Deploy a multi-container Docker Compose stack with persistent volumes, private networking, health checks and registry image pulls.

Intermediate
20 min
Updated 2026-11-12

Deploy Ready-to-Run Infrastructure in Seconds

Linux VMs from $6/mo · Pooled Virtual Datacenters from $12/mo · Use code WELCOME20 for 20% off your first order.

Browse ServersView Pricing

Commands checked on 2026-11-12 with Docker Engine 27.3, Docker Compose 2.29, sau CLI 0.2.0.

What you will have at the end

You will have a three-service production Docker Compose stack—a web API, PostgreSQL 17 with a persistent named volume, and a Caddy HTTPS reverse proxy—running on an isolated Managed Docker host with internal container-only database networking, health-gated startup ordering, and private OCI registry authentication.

Before you start

  • A Managed Docker host ordered from /containers or Home > Create a resource (/dashboard/store), or any Ubuntu 24.04 Linux VPS with Docker Engine installed.
  • Optional: A private OCI repository in Compute > Container registry (/dashboard/container-registry) if you are pulling proprietary application images.
  • A domain name pointed at your Docker host's public IPv4 address (203.0.113.45 in the examples below) with inbound ports 80 and 443 allowed in Network > Firewall (/dashboard/network?tab=firewall).

Steps

1. Create a structured stack directory and secrets file on the host

Open a browser terminal on Access > Access console (/dashboard/console) or connect via sau ssh <instance-id>, then create an isolated directory /opt/stacks/prod-api with restrictive permissions on .env:

sudo install -d -m 0755 /opt/stacks/prod-api
cd /opt/stacks/prod-api

sudo tee .env > /dev/null <<'EOF'
POSTGRES_DB=app_prod
POSTGRES_USER=app_writer
POSTGRES_PASSWORD=replace_with_32_char_random_secret
APP_DOMAIN=api.example.com
APP_IMAGE=ghcr.io/your-org/prod-api:1.4.2
EOF
sudo chmod 0600 .env

2. Authenticate with SAU Container Registry (optional for private images)

If your image lives in your private Compute > Container registry (/dashboard/container-registry), inspect your registry endpoint with the CLI and sign in on the Docker host using a scoped pull token:

# On your workstation: inspect your private registry
sau acr list -o table

# On the Managed Docker host: sign in with a read-only registry token
echo "YOUR_SCOPED_PULL_TOKEN" | sudo docker login registry.serversareup.com -u token --password-stdin

3. Write a production compose.yaml with isolated internal networking

Create /opt/stacks/prod-api/compose.yaml with two networks (edge for Caddy + API, and backend marked internal: true so PostgreSQL has zero outbound or inbound internet route) and service_healthy startup dependencies:

sudo tee /opt/stacks/prod-api/compose.yaml > /dev/null <<'EOF'
services:
  db:
    image: postgres:17-alpine
    restart: unless-stopped
    environment:
      POSTGRES_DB: ${POSTGRES_DB}
      POSTGRES_USER: ${POSTGRES_USER}
      POSTGRES_PASSWORD: ${POSTGRES_PASSWORD}
    volumes:
      - pgdata:/var/lib/postgresql/data
    networks:
      - backend
    healthcheck:
      test: ["CMD-SHELL", "pg_isready -U $$POSTGRES_USER -d $$POSTGRES_DB"]
      interval: 10s
      timeout: 3s
      retries: 5

  api:
    image: ${APP_IMAGE}
    restart: unless-stopped
    depends_on:
      db:
        condition: service_healthy
    environment:
      DATABASE_URL: postgresql://${POSTGRES_USER}:${POSTGRES_PASSWORD}@db:5432/${POSTGRES_DB}
      PORT: "8080"
    networks:
      - backend
      - edge
    healthcheck:
      test: ["CMD-SHELL", "wget -qO- http://127.0.0.1:8080/healthz || exit 1"]
      interval: 15s
      timeout: 3s
      retries: 3

  proxy:
    image: caddy:2.8-alpine
    restart: unless-stopped
    depends_on:
      api:
        condition: service_healthy
    ports:
      - "80:80"
      - "443:443"
      - "443:443/udp"
    command: caddy reverse-proxy --from ${APP_DOMAIN} --to api:8080
    volumes:
      - caddy_data:/data
      - caddy_config:/config
    networks:
      - edge

networks:
  edge:
  backend:
    internal: true

volumes:
  pgdata:
  caddy_data:
  caddy_config:
EOF

4. Validate and launch the Compose stack

Validate variable interpolation first, then pull pinned images and bring the stack up in detached mode:

cd /opt/stacks/prod-api
sudo docker compose config -q
sudo docker compose pull
sudo docker compose up -d --remove-orphans

Check that it works

Inspect container health states on the host and verify that PostgreSQL is unreachable from the public internet while the HTTPS API answers cleanly:

sudo docker compose -f /opt/stacks/prod-api/compose.yaml ps
curl -fsSI https://api.example.com/healthz

Every container in docker compose ps should report (healthy) (or Up for Caddy), and sudo ss -tlnp on the host should show only ports 80 and 443 bound publicly—never 5432 or 8080.

What can go wrong

  • Publishing "5432:5432" in compose.yaml accidentally exposes PostgreSQL bypassing ufw on Linux. Docker manipulates iptables/nftables FORWARD chains directly on standard Linux installations. Never add ports: to database containers, and keep your perimeter firewall default-closed on Network > Firewall (/dashboard/network?tab=firewall) so only 80 and 443 traverse the datacenter edge!
  • api fails at boot with getaddrinfo ENOTFOUND db or connection refused. Always pair depends_on: db: condition: service_healthy with a real pg_isready health check so the API container waits until PostgreSQL accepts TCP connections.
  • Disk fills up after weeks of docker compose pull updates. Schedule weekly cleanup of unused image layers (sudo docker image prune -af --filter "until=168h")—never pass --volumes to prune in production.

Good practice

  • Pin exact semantic version tags or @sha256 digests on every image (postgres:17.2-alpine, caddy:2.8.4-alpine) rather than floating :latest tags.
  • Back up named database volumes logically (docker compose exec -T db pg_dump -Fc ...) to Home > Cloud storage & pub/sub (/dashboard/blob-storage) every night rather than copying raw /var/lib/docker/volumes while PostgreSQL is writing WAL segments.
  • Scan container images for critical CVEs and lock production image tags in Compute > Container registry (/dashboard/container-registry).

Where to go next

  • Deploy and expose your first app on Managed Kubernetes
  • Run serverless functions, workflows, queues and OCI registries
  • Snapshot a server before a change and restore safely

Related Articles

Create a scoped API key and send your first v1 request

Read more

Route APIs with Edge WAF, rate limits and Cloud DNS

Read more

Purchase Azure-backed cloud storage with WORM locks and SAS

Read more

Frequently Asked Questions

What does the Run your first Docker Compose stack on Managed Docker documentation guide cover?
Deploy a multi-container Docker Compose stack with persistent volumes, private networking, health checks and registry image pulls. It is rated intermediate difficulty (20 min) and applies to Servers Are Up infrastructure and workflows.
Can I manage or automate these steps through the Servers Are Up dashboard, REST API v1, or MCP server?
Yes. Every Servers Are Up server includes browser-based SSH, WebRDP, and VNC console access in the dashboard, plus programmatic control via the REST API v1 (/api/v1) and hosted Model Context Protocol server (/api/mcp/v1) using a scoped Personal Access Token.

Need hands-on help with Run your first Docker Compose stack on Managed Docker?

Every Servers Are Up virtual machine and container includes an integrated HTML5 browser-based SSH, RDP, and VNC console in your dashboard, default-off inbound firewall rules with per-IP allow-lists, and full programmatic control via REST API v1 and Model Context Protocol (MCP). Explore our Virtual Datacenter Plans or reach out to Servers Are Up Support.

Was this article helpful?

On this page

What you will have at the endBefore you startSteps1. Create a structured stack directory and secrets file on the host2. Authenticate with SAU Container Registry (optional for private images)3. Write a production compose.yaml with isolated internal networking4. Validate and launch the Compose stackCheck that it worksWhat can go wrongGood practiceWhere to go next