Importing Docker Compose Files
Quant Cloud supports importing standard docker-compose.yml files, allowing you to leverage your existing Docker Compose definitions with minimal changes. The platform automatically translates compose syntax into optimized cloud configurations.
Supported Docker Compose Features
Section titled “Supported Docker Compose Features”Service-Level Configuration
Section titled “Service-Level Configuration”services: web: image: nginx:latest # External image app: image: latest # Internal ECR (tag only)Commands and Entrypoints
Section titled “Commands and Entrypoints”services: app: command: ["php", "artisan", "queue:work"] # OR command: php artisan queue:work
entrypoint: ["/usr/local/bin/entrypoint.sh"] # OR entrypoint: /usr/local/bin/entrypoint.shSupports both string and array formats.
Environment Variables
Section titled “Environment Variables”services: app: environment: - DATABASE_HOST=mysql - DATABASE_PORT=3306 # OR environment: DATABASE_HOST: mysql DATABASE_PORT: 3306Supports both array and object formats.
Port Exposure
Section titled “Port Exposure”services: web: ports: - "80" # Container port only - "8080:80" # Host:container mappingVolume Mounts
Section titled “Volume Mounts”volumes: db-data: uploads:
services: db: volumes: - db-data:/var/lib/mysql - uploads:/var/www/html/uploadsReferenced volumes are automatically created as EFS logical volumes if they don’t exist.
Container Dependencies
Section titled “Container Dependencies”services: app: depends_on: - db - redis # OR with conditions depends_on: db: condition: service_healthy redis: condition: service_startedSupported conditions: START, HEALTHY, COMPLETE, SUCCESS
Health Checks
Section titled “Health Checks”services: web: healthcheck: test: ["CMD", "curl", "-f", "http://localhost/health"] interval: 30s timeout: 5s retries: 3 start_period: 40sWorking Directory and User
Section titled “Working Directory and User”services: app: working_dir: /app user: "1000:1000"Resource Configuration
Section titled “Resource Configuration”Using Standard Deploy Syntax:
services: app: deploy: resources: limits: cpus: '1' memory: 2048M reservations: memory: 1024M replicas: 2Using Quant Labels:
services: app: labels: - "quant.cpu=1024" - "quant.memory=2048" - "quant.memory.reservation=1024"Top-Level Configuration
Section titled “Top-Level Configuration”Task-Level Resources
Section titled “Task-Level Resources”x-quant-labels: quant.task.cpu: "2048" # Total vCPU (1024 = 1 vCPU) quant.task.memory: "4096" # Total memory in MiB quant.architecture: "ARM64" # ARM64 or X86_64Volume Definitions
Section titled “Volume Definitions”volumes: db-data: cache-data:Automatically created as EFS logical volumes with default paths.
Unsupported Features
Section titled “Unsupported Features”builddirectives (use pre-built images)networks(automatic service discovery provided)secrets(use Quant Cloud secrets management)configs(use environment variables or volumes)- Host network mode, privileged mode, device mappings
Service Filtering
Section titled “Service Filtering”Exclude services from import:
services: local-only: image: mailhog/mailhog labels: - "quant.type=none"Resource Limits
Section titled “Resource Limits”Task-level CPU and memory must follow the below combinations:
| CPU (units) | vCPU | Memory Options (MiB) |
|---|---|---|
| 256 | 0.25 | 512, 1024, 2048 |
| 512 | 0.5 | 1024, 2048, 3072, 4096 |
| 1024 | 1 | 2048-8192 (1024 MiB increments) |
| 2048 | 2 | 4096-16384 (1024 MiB increments) |
| 4096 | 4 | 8192-30720 (1024 MiB increments) |
Invalid values are automatically adjusted with warnings.
Complete Example
Section titled “Complete Example”version: "3.8"
x-quant-labels: quant.task.cpu: "2048" quant.task.memory: "4096" quant.architecture: "X86_64"
volumes: db-data: uploads:
services: web: image: nginx:latest ports: - "80" - "443" labels: - "quant.cpu=1024" - "quant.memory=2048" volumes: - uploads:/var/www/html/uploads:ro healthcheck: test: ["CMD", "curl", "-f", "http://localhost/health"] interval: 30s timeout: 5s retries: 3 depends_on: app: condition: service_healthy
app: image: php:8.2-fpm command: ["php-fpm", "-F"] working_dir: /var/www/html user: "www-data" deploy: resources: limits: cpus: '1' memory: 1024M volumes: - uploads:/var/www/html/uploads environment: DB_HOST: db REDIS_HOST: redis depends_on: - db - redis
db: image: mysql:8.0 volumes: - db-data:/var/lib/mysql environment: MYSQL_ROOT_PASSWORD: ${DB_PASSWORD} healthcheck: test: ["CMD", "mysqladmin", "ping", "-h", "localhost"] interval: 10s timeout: 5s retries: 5
redis: image: redis:7-alpine command: ["redis-server", "--appendonly", "yes"]Image Tag Suffixing
Section titled “Image Tag Suffixing”For feature branch deployments, append a suffix to internal image tags:
# Query parameter or JSON wrapperimageSuffix: "feature-xyz"
# Transforms internal images# "latest" becomes "web-feature-xyz"# External images unchanged: "nginx:latest" stays "nginx:latest"Perfect for PR previews and feature branch environments.
What Happens During Import
Section titled “What Happens During Import”- Parse & Validate - YAML syntax and structure validation
- Translate - Convert to Quant Cloud’s internal format
- Volume Creation - Auto-create any missing volumes
- Task Definition - Generate ECS task definition
- Deploy - Update service and trigger deployment
API Reference
Section titled “API Reference”Import Endpoint:
POST /organizations/{orgName}/apps/{appName}/environments/{envName}/compose/importValidation Endpoint (dry-run):
POST /organizations/{orgName}/apps/{appName}/environments/{envName}/compose/import/validateExample:
curl -X POST \ -H "X-Api-Secret: your-api-key" \ -H "Content-Type: application/x-yaml" \ --data-binary @docker-compose.yml \ https://dashboard.quantcdn.io/v3/organizations/my-org/apps/my-app/environments/production/compose/importBest Practices
Section titled “Best Practices”- Start Simple - Test with basic compose files first
- Specify Resources - Always define
x-quant-labelsfor CPU/memory - Use Health Checks - Enable zero-downtime deployments
- Validate Locally - Run
docker-compose configbefore importing - Version Images - Use specific tags in production
- Use Secrets Management - Don’t hardcode credentials
Troubleshooting
Section titled “Troubleshooting”“Invalid CPU/memory combination”
- Check permitted combinations table above
- Platform auto-corrects with warnings
“Volume not found”
- Volumes auto-create with default paths
- Create manually for custom paths
“Image not accessible”
- Verify internal tags exist in ECR
- Check external image names are correct
“Port mapping conflicts”
- Ensure unique ports across containers
Additional Resources
Section titled “Additional Resources”- GitHub Actions - Complete CI/CD automation
- Init Action - Start here for workflows
- Compose Action - Translate compose files
- API Documentation
- Validate compose files:
docker-compose config