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

Environment variable set with `-e` but the app doesn't see it.

IntermediateTroubleshootingContainers that exit, crash or misbehave
Answer

Likely causes → Flag placed after the image name (treated as command args), typo, entrypoint script sanitises env, app reads a config file instead.

Diagnose →

docker exec c env | sort
docker inspect -f '{{.Config.Env}}' c

Fix → docker run -e FOO=bar image (options before image). Check how the app reads variables.

Prevent → Print effective config on startup (without secrets).

All Docker questions Roadmap: Docker & containers

More on Containers that exit, crash or misbehave