Urgent.News

What's breaking now, across thousands of outlets.

Tech

Hardening Production Multi-Container Topologies with Docker Compose v2

Eliminate silent startup failures, race conditions, and network exposure in multi-container stacks using Docker Compose v2 health gates and least privilege.

Hardening Production Multi-Container Topologies with Docker Compose v2

Docker Compose v2 introduces a more resilient approach to multi-container production topologies. Naive Compose stacks often fail due to issues like bootstrap latency, migration races, flat network configurations, and plain-text credentials. To improve stack reliability, treat startup order, network reachability, credentials, and resource ceilings as explicit contracts that can be tested.

Implement deterministic startup using health checks. Compose v2's long-form depends_on allows specifying conditions for dependencies, such as service_started, service_healthy, or service_completed_successfully. This enables separate processes for tasks like migrations, ensuring they run after the database is healthy and preventing scaling-related conflicts.

Segment the network into two user-defined bridge networks: dmz for Nginx and the app, and backend_net for the app, Postgres, and Redis. Only Nginx should publish a host port, while backend_net is internal and unreachable from the host. Move credentials out of environment variables and into top-level secrets, mounting them as /run/secrets/. This prevents exposure in docker inspect output or process environments.

Finally, enforce resource limits and non-root enforcement to prevent kernel OOM killer issues. Compose v2's deploy.resources settings can be used outside Swarm to set hard limits on CPU usage. By implementing these hardening measures, a Compose stack can survive in production, providing a more stable and secure environment.

Written by urgent.news from HackerNoon's reporting — not their text. Machine-written — may contain errors; check the original before relying on it.

Read the original at hackernoon.com →

More in Tech

A read-only Azure scanner that shows waste from your actual bill

Most Azure estates carry two kinds of quiet debt. The first costs money every month: a disk left behind when a VM was deleted, a public IP nobody uses, a VM that was "stopped" but never deallocated…

  • Skyveda Scan identifies waste in Azure accounts
  • Tool checks 60 factors across security, reliability, cost
  • No changes, deletions, or secret access by Skyveda Scan

Photogrammetry, lithophane, or image to 3D? Three ways to get a printable model from a picture

"Can I 3D print this photo?" comes up a lot, and the honest answer is "depends what you mean by print it". There are at least three different things people are asking for, and they need different…

  • Lithophane technique converts photos into thin plates with brightness-based thickness
  • Photogrammetry captures multiple images to digitally reconstruct object geometry
  • Image-to-3D conversion uses AI to generate 3D meshes from photos or sketches

More from Thursday 5 November →