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

Application can't resolve its own hostname or `sudo: unable to resolve host`.

IntermediateTroubleshootingContainers that exit, crash or misbehave
Answer

Likely causes → Custom --hostname or --network host produce mismatched /etc/hosts; or /etc/hosts overwritten.

Diagnose → docker exec c cat /etc/hosts; hostname

Fix → Use --add-host name:ip, don't edit /etc/hosts manually (it's regenerated on start).

Prevent → Rely on DNS names, not hosts files.

All Docker questions Roadmap: Docker & containers

More on Containers that exit, crash or misbehave