Docs/ Deployment/ Docker Compose

Docker Compose

Deploy multi-container applications by pasting your docker-compose.yml directly into the sh0 dashboard. sh0 validates, provisions, and manages every service in your stack.

Overview

Docker Compose is a standard format for defining multi-container applications. sh0 supports deploying compose files directly, converting each service into a managed container with networking, volumes, and environment variables handled automatically.

This is ideal for applications that consist of multiple services -- for example, a web application with a database, a cache layer, and a background worker.

Deploying a Compose Stack

To deploy from a compose file, navigate to your stack and select New AppDocker Compose. Paste your docker-compose.yml content into the editor.

Docker Compose editor in the sh0 dashboard with YAML input

Here is an example of a typical compose file for a web application with PostgreSQL and Redis:

docker-compose.yml
version: "3.8"

services:
  web:
    image: myapp:latest
    ports:
      - "3000:3000"
    environment:
      DATABASE_URL: postgres://user:pass@db:5432/myapp
      REDIS_URL: redis://cache:6379
    depends_on:
      - db
      - cache

  db:
    image: postgres:16
    volumes:
      - pgdata:/var/lib/postgresql/data
    environment:
      POSTGRES_USER: user
      POSTGRES_PASSWORD: pass
      POSTGRES_DB: myapp

  cache:
    image: redis:7-alpine

volumes:
  pgdata:

Validation

Before deploying, sh0 validates your compose file and reports any issues:

  • YAML syntax errors with line numbers
  • Unknown or unsupported directives
  • Invalid image references
  • Port conflicts with existing services
  • Volume mount path issues
Compose validation results showing a warning about port conflicts
Note
sh0 validates your compose file in real time as you type. Errors appear inline in the editor with suggestions for how to fix them.

Supported Features

sh0 supports the most commonly used Docker Compose directives. Here is a breakdown of what is available.

Services

Each service in your compose file becomes a managed container in sh0. Supported service options include:

  • image -- Pull from Docker Hub or any registry
  • build -- Not imported. sh0 refuses a Compose service that declares build: and says what to do instead: deploy that service from its Git repository (sh0 builds the Dockerfile itself), or publish the image to a registry and reference it with image.
  • ports -- Expose ports (mapped through Caddy reverse proxy)
  • command and entrypoint -- Override container startup
  • depends_on -- Service startup ordering
  • restart -- Restart policies (always, unless-stopped, on-failure)
  • healthcheck -- Custom health checks
  • deploy.resources -- CPU and memory limits

Volumes and Networks

Named volumes are automatically created and managed by sh0. Data persists across container restarts and redeployments.

Volume configuration
volumes:
  pgdata:
    driver: local
  uploads:
    driver: local

services:
  web:
    volumes:
      - uploads:/app/uploads
  db:
    volumes:
      - pgdata:/var/lib/postgresql/data

Services within a compose stack are automatically placed on a shared Docker network. They can reach each other by service name -- for example, the web service can connect to db:5432 without any additional configuration.

Environment Variables

Environment variables defined in your compose file are imported into sh0. You can also override or add variables through the dashboard after deployment.

Warning
Avoid hardcoding secrets in your compose file. Instead, use the sh0 Environment Variables panel to set sensitive values. They are encrypted at rest and injected at container startup.

Managing Services

Once deployed, each service in your compose stack appears as an individual app within your sh0 stack. You can manage each service independently:

  • View real-time logs for each service
  • Monitor CPU and memory usage per container
  • Restart individual services without affecting others
  • Open a terminal session into any container
  • Assign custom domains to specific services
Stack view showing three compose services (web, db, cache) with status indicators
Individual service detail view with logs, metrics, and terminal tabs
Tip
You can scale individual services independently. For example, run three instances of your web service while keeping a single database instance.

Updating Compose Config

To update your compose configuration, navigate to your stack and select Edit Compose. sh0 compares your new configuration against the current one and determines which services need to be recreated, updated, or removed.

Compose diff view highlighting changes between current and updated configuration

Changes are applied incrementally:

  • Image change: The service is redeployed with the new image
  • Environment variable change: The container is restarted with updated variables
  • New service added: A new container is created and started
  • Service removed: The container is stopped (data volumes are preserved)
  • Port change: The reverse proxy configuration is updated automatically
Note
Volumes are never deleted during compose updates. Even if you remove a service, its data volumes remain available and can be reattached later.