Docker Compose Tip #26: Using restart policies effectively

Keep your services running! Restart policies ensure containers recover from crashes automatically. Available restart policies Docker Compose offers four restart options: services: # Never restart (default) dev-tool: image: debug-tools restart: "no" # Restart only on failure (non-zero exit) api: image: api:latest restart: on-failure # Always restart unless manually stopped web: image: nginx restart: unless-stopped # Always restart, even after Docker daemon restarts database: image: postgres:15 restart: always Choosing the right policy Development services: ...

February 9, 2026 · 2 min · 346 words · Guillaume Lours

Docker Compose Tip #25: Using docker compose events for monitoring

Track everything happening in your Compose stack! Events provide real-time insights into container lifecycle changes. Basic event monitoring Watch events as they happen: # Stream all events docker compose events # JSON format for parsing docker compose events --json # Specific services only docker compose events web worker # Since a specific time docker compose events --since "2026-02-06T10:00:00" Event types Common events you’ll see: container create # Container created container start # Container started container stop # Stop initiated container die # Container exited container destroy # Container removed health_status # Health check changed network connect # Network attached network disconnect # Network detached Processing events Parse with jq: ...

February 6, 2026 · 3 min · 555 words · Guillaume Lours

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

Docker Compose Tip #23: Multi-platform builds with platforms

Build once, run everywhere! Create images that work on ARM Macs, Intel servers, and Raspberry Pi with a single build command. Configure multi-arch builder Docker Desktop handles this by default. For other Docker installations, set up buildx: # Only needed if not using Docker Desktop # Create and use a new builder docker buildx create --name multiarch --use # Verify available platforms docker buildx ls Configure platforms Specify target architectures in your compose file: ...

February 4, 2026 · 3 min · 470 words · Guillaume Lours

Docker Compose Tip #22: Using secrets in Compose files

Stop hardcoding passwords! Docker Compose secrets provide a secure way to handle sensitive data. Basic secret setup Define secrets and use them in services: secrets: db_password: file: ./secrets/db_password.txt api_key: file: ./secrets/api_key.txt services: app: image: myapp:latest secrets: - db_password - api_key environment: DB_PASSWORD_FILE: /run/secrets/db_password API_KEY_FILE: /run/secrets/api_key Secrets appear as files in /run/secrets/ inside containers. Reading secrets in your app Node.js example: ...

February 3, 2026 · 2 min · 270 words · Guillaume Lours