Skip to content
_CORE
AI & Agentic Systems Core Information Systems Cloud & Platform Engineering Data Platform & Integration Security & Compliance QA, Testing & Observability IoT, Automation & Robotics Mobile & Digital Banking & Finance Insurance Public Administration Defense & Security Healthcare Energy & Utilities Telco & Media Manufacturing Logistics & E-commerce Retail & Loyalty
References Technologies Blog Know-how Tools
About Collaboration Careers
CS EN DE
Let's talk

Docker Compose: 10 Advanced Techniques

25. 05. 2025 Updated: 27. 03. 2026 1 min read intermediate

Docker Compose is more than “docker compose up”. Here are 10 advanced techniques.

1. Profiles

services: debug: profiles: [debug]

Docker Compose: 10 Advanced Techniques

2. YAML Anchors

x-common: &common restart: unless-stopped services: app: <<: *common

3. Health Checks + depends_on

services: db: healthcheck: test: [“CMD-SHELL”, “pg_isready”] app: depends_on: db: { condition: service_healthy }

4. Env Files

env_file: [.env, .env.local]

5. Named Volumes

volumes: pgdata: services: db: volumes: [“pgdata:/var/lib/postgresql/data”]

6. Internal Networks

networks: backend: { internal: true }

7. Resource Limits

deploy: resources: limits: { memory: 512M, cpus: “1.0” }

8. Multi-file Compose

docker compose -f compose.yml -f compose.prod.yml up

9. Init Containers

migrate: command: [“python”, “manage.py”, “migrate”] app: depends_on: migrate: { condition: service_completed_successfully }

10. Watch Mode

develop: watch: - action: sync path: ./src target: /app/src

Tip

Profiles for dev/prod, health checks for startup order, YAML anchors against duplication.

dockerdocker composedevops
Share:

CORE SYSTEMS team

We build core systems and AI agents that keep operations running. 15 years of experience with enterprise IT.