Interview Prep/Docker/Image design and Dockerfile decisions

Product asks for a container that runs both nginx and a Python app. What do you say?

BeginnerScenarioImage design and Dockerfile decisions
Answer

Situation read → One-process-per-container is a guideline, not a law, but mixing hurts signal handling, scaling and logs.

What I'd do →

  1. Propose two containers (nginx + app) in one Compose file or one Pod.
  2. Share traffic via a user-defined network, or a Unix socket on a shared volume.
  3. If truly required, use a minimal init such as tini or s6-overlay to supervise both.

Why → Independent restarts, independent scaling, clean docker logs per concern.

Interview tip → Acknowledge the exception (sidecars/supervised legacy apps) rather than being dogmatic.

All Docker questions Roadmap: Docker & containers

More on Image design and Dockerfile decisions