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 App → Docker Compose. Paste your docker-compose.yml content into the editor.
Here is an example of a typical compose file for a web application with PostgreSQL and Redis:
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
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 registrybuild-- Not imported. sh0 refuses a Compose service that declaresbuild: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 withimage.ports-- Expose ports (mapped through Caddy reverse proxy)commandandentrypoint-- Override container startupdepends_on-- Service startup orderingrestart-- Restart policies (always,unless-stopped,on-failure)healthcheck-- Custom health checksdeploy.resources-- CPU and memory limits
Volumes and Networks
Named volumes are automatically created and managed by sh0. Data persists across container restarts and redeployments.
volumes:
pgdata:
driver: local
uploads:
driver: local
services:
web:
volumes:
- uploads:/app/uploads
db:
volumes:
- pgdata:/var/lib/postgresql/dataServices 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.
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
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.
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