Docker Compose Tip #24: Using profiles to organize optional services

Keep your Compose stack flexible! Profiles let you include or exclude services based on your current needs. Basic profiles Define optional services with profiles: services: app: image: myapp:latest ports: - "3000:3000" # No profile - always starts debug: image: debug-tools profiles: - debug # Only starts with --profile debug test-db: image: postgres:15 profiles: - test environment: POSTGRES_DB: test_db Starting with profiles Choose which services to include: ...

February 5, 2026 · 2 min · 376 words · Guillaume Lours