Kubernetes "CreateContainerError" on deploy in CI - Fix it
CreateContainerError is a runtime-level failure: the image is present and the config resolved, but containerd/CRI could not actually create the container. The describe message carries the specific cause.
What this error means
The pod sits in CreateContainerError. kubectl describe pod shows a kubelet message such as Error: failed to create containerd container, a duplicate container name, or a bad working directory / executable.
Warning Failed kubelet Error: failed to create containerd task: OCI
runtime create failed: exec: "/app/start": stat /app/start: no such file or directoryCommon causes
Bad command, args, or workingDir
The command/args reference a binary or path that does not exist in the image, or workingDir points at a directory that is not present.
Runtime-level conflict
A duplicate container name, a hostPath that does not exist, or a CRI/containerd error prevents container creation even though scheduling and image pull succeeded.
How to fix it
Read the kubelet error
The message after Error: in describe is the precise runtime failure.
kubectl describe pod <pod> | sed -n '/Events/,$p'Correct the spec
- If the entrypoint/binary path is wrong, fix
command/argsto match what is in the image (docker run --entrypoint sh <image>to inspect). - Ensure
workingDirand anyhostPathmounts exist in the image/node. - Re-apply and confirm the container is created.
How to prevent it
- Test the exact image+command locally before deploying.
- Avoid hostPath mounts in CI deploys; prefer ConfigMap/emptyDir.
- Keep entrypoints in the image (ENTRYPOINT) rather than overriding command in the manifest where possible.