Interview Prep/Docker/Containers that exit, crash or misbehave

Container works with `docker run -it` but fails when started detached with `-d`.

IntermediateTroubleshootingContainers that exit, crash or misbehave
Answer

Likely causes → The app expects a TTY or stdin (interactive prompts), or reads from stdin and gets EOF.

Diagnose → docker logs c; compare with docker run -d -t.

Fix → Provide config non-interactively, use -t/-i only if truly needed, or tail -f /dev/null for dev placeholder (not prod).

Prevent → Make apps non-interactive.

All Docker questions Roadmap: Docker & containers

More on Containers that exit, crash or misbehave