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

`docker run` argument is ignored: `docker run image --port 9000` fails with `unknown flag`.

IntermediateTroubleshootingContainers that exit, crash or misbehave
Answer

Likely causes → Args after the image replace CMD entirely (and are appended to ENTRYPOINT).

Diagnose → docker inspect -f '{{.Config.Entrypoint}} {{.Config.Cmd}}' image

Fix → Pass the full command (image app --port 9000) when only CMD is defined; with ENTRYPOINT pass only the extra args; override with --entrypoint.

Prevent → Document the entrypoint contract.

All Docker questions Roadmap: Docker & containers

More on Containers that exit, crash or misbehave