Interview Prep/Kubernetes/Pod startup failures

The container exits with `exec /docker-entrypoint.sh: no such file or directory`, but the file is clearly in the image.

IntermediateTroubleshootingPod startup failures
Answer

Likely causes → The file exists but its interpreter does not: Windows CRLF line endings make the shebang /bin/sh\r, or the shebang points to /bin/bash on an Alpine or distroless image, or a binary is dynamically linked against glibc on musl.

Diagnose →

docker run --rm --entrypoint sh registry.example.com/web:1.4 -c 'head -1 /docker-entrypoint.sh | od -c | head -2'
docker run --rm --entrypoint sh registry.example.com/web:1.4 -c 'ls /bin/bash; ldd /app/server'

Fix → Convert line endings (dos2unix, .gitattributes with *.sh text eol=lf), use #!/bin/sh, or build static binaries (CGO_ENABLED=0) for distroless/Alpine.

Prevent → .gitattributes in every repo and an image smoke test in CI.

All Kubernetes questions Roadmap: Kubernetes core

More on Pod startup failures