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

Docker Compose Tip #21: Understanding bridge vs host networking modes

Choose the right networking mode for your containers. Understand when isolation matters and when performance is key. Bridge mode (default) The default and most secure option - containers get their own network namespace: services: web: image: nginx ports: - "8080:80" # Port mapping required networks: - app_network db: image: postgres:15 networks: - app_network networks: app_network: driver: bridge Containers can communicate using service names (web, db) within the network. ...

February 2, 2026 · 2 min · 330 words · Guillaume Lours

Docker Compose Tip #18: Graceful shutdown with stop_grace_period

Give your containers time to clean up. Configure grace periods to ensure database connections close, transactions complete, and data saves properly. The problem By default, Docker gives containers 10 seconds to stop before forcefully killing them: services: app: image: myapp:latest # Container gets SIGTERM, then SIGKILL after 10s This can interrupt long-running operations and corrupt data. The solution Use stop_grace_period to extend shutdown time: services: worker: image: myworker:latest stop_grace_period: 2m # 2 minutes to finish current job stop_signal: SIGTERM # Signal to send first (default) Real-world examples Different services need different grace periods: ...

January 28, 2026 · 2 min · 358 words · Guillaume Lours

Docker Compose Tip #17: YAML anchors to reduce duplication

Stop copy-pasting the same configuration. YAML anchors let you define once and reuse everywhere in your Compose files. The basics Define an anchor with & and reference it with *: services: web: &default-app image: myapp:latest environment: NODE_ENV: production LOG_LEVEL: info networks: - app-network worker: <<: *default-app # Inherit all settings from web command: npm run worker The worker service inherits everything from web, then overrides the command. ...

January 27, 2026 · 2 min · 297 words · Guillaume Lours