Introduction

Kubernetes RunContainerError means the Pod reached a node, the image was available, and the container was created, but the runtime could not start the configured process. The useful evidence is the final clause in the runtime message: permission denied, exec format error, missing interpreter, bad working directory, or a device and mount failure.

Illustrative composite: at 02:40 a checkout Deployment rolls out a new image that passed CI on an amd64 builder. The first Pod lands on an arm64 node pool added for cost reasons. kubectl get pods shows RunContainerError, the restart count climbs, and the on-call engineer checks application logs that do not exist yet. The event message ends with exec format error. The application never started, so there is no application bug to chase. The image architecture and node architecture disagree, and the fix belongs in the build pipeline, not in the service code.

That pattern is why RunContainerError deserves its own runbook. It looks like a Pod failure, but the fault sits at the boundary between the Pod spec, the image filesystem, Linux exec rules, and the node runtime. If you treat it as a generic crash, you waste time reading logs from a process that never ran. If you read the runtime message from the end backwards, the cause usually becomes plain.

The 5-minute takeaway

Run kubectl describe pod and copy the full container message, not just the status word. Then read the last clause after OCI runtime create failed, runc create failed, or failed to start container. That clause tells you whether to inspect the entrypoint, file permissions, CPU architecture, interpreter, working directory, security context, mount, device, or node runtime. The Pod Lifecycle guide explains where Waiting, Running, and Terminated sit in the wider Pod story.


1. What Kubernetes RunContainerError means

Kubernetes RunContainerError is a waiting reason that appears when the kubelet has a container to start but the runtime cannot launch its process successfully. The image pull and scheduling steps have usually passed. The failure is at process start: the runtime tried to execute the configured command and the operating system, filesystem, or runtime rejected that start.

The important detail is that RunContainerError is a symptom, not a root cause. Two Pods can show the same status for opposite reasons. One may have a script without the execute bit. Another may have a binary built for the wrong CPU architecture. A third may have a valid binary but a securityContext that prevents the process from reading its own entrypoint. The status tells you where to look; the message tells you what broke.

In the Pod status, the container is commonly shown as Waiting with reason RunContainerError, while the last terminated state may show ContainerCannotRun or a runtime-specific message. That split confuses people. The waiting reason is the current kubelet view. The terminated message often carries the lower-level runtime error. Read both. If the Pod is also entering backoff, the visible status may later become CrashLoopBackOff, but the first start failure still matters.

RunContainerError also tells you what not to debug first. Service routing, ingress rules, readiness probes, and application configuration files loaded after process start are downstream. The process has not reached the point where it can open a port, emit useful logs, or fail a probe. Start with the runtime message, the image contents, and the exact command Kubernetes is trying to execute.


2. Kubernetes RunContainerError vs CreateContainerError and CrashLoopBackOff

RunContainerError differs from CreateContainerError by timing: the container has been created far enough for a start attempt, but the process cannot run. CreateContainerError points earlier, at container creation through the runtime interface. CrashLoopBackOff is later still: Kubernetes is backing off repeated restarts after failed starts or exits.

Use the distinction as a triage shortcut. If the message says the container could not be created because a mount, sandbox, device, or runtime create call failed before a start attempt, treat it as a creation problem. If the message says failed to start container, starting container process caused, or unable to start container process, treat it as RunContainerError territory. The words exec, permission denied, no such file or directory, and exec format error usually point to the process launch path.

CrashLoopBackOff overlaps because Kubernetes restarts failed containers with backoff. A RunContainerError can become CrashLoopBackOff after repeated attempts. The reverse is not always true. A container that starts, prints a stack trace, and exits with code 1 can enter CrashLoopBackOff without ever having a runtime start failure. That is why the CrashLoopBackOff guide starts with logs and exit codes, while this guide starts with the runtime message and image filesystem.

Status What failed First evidence to read Typical owner
CreateContainerError Container creation through the runtime CRI create error, mount or sandbox message Platform, node, Pod spec
RunContainerError Process start after container creation Final exec, permission, interpreter, or runtime clause Image, Pod spec, runtime
CrashLoopBackOff Repeated restart backoff Logs, exit code, probe and config errors Application, config, resources

3. Read the Kubernetes RunContainerError message from the end

The fastest RunContainerError fix starts by reading the runtime message backwards. Runtime errors are wrapped in layers: kubelet, CRI, containerd or CRI-O, shim, OCI runtime, and finally the Linux error. The prefix tells you which layer reported the failure. The final clause tells you which check actually failed.

Start with the Pod events and container status:

bash
kubectl describe pod <pod-name> -n <namespace>
kubectl get pod <pod-name> -n <namespace> -o jsonpath='{.status.containerStatuses[0].state.waiting.reason}{"\n"}{.status.containerStatuses[0].state.waiting.message}{"\n"}'
kubectl get pod <pod-name> -n <namespace> -o jsonpath='{.status.containerStatuses[0].lastState.terminated.reason}{"\n"}{.status.containerStatuses[0].lastState.terminated.message}{"\n"}{.status.containerStatuses[0].lastState.terminated.exitCode}{"\n"}'

Do not stop at failed to create containerd task or OCI runtime create failed. Those phrases are wrappers. Look for the tail: exec: "/app/start.sh": permission denied, exec: "node": executable file not found in $PATH, exec format error, no such file or directory, error mounting, or failed to write ... to memory.max. Each tail routes you to a different fix.

Also capture the exact image, command, args, working directory, and security context from the Pod spec. A screenshot of RunContainerError is not enough for a handoff. The useful incident record contains the full message, image digest, node name, node architecture, container name, restart count, and the command Kubernetes attempted. With those fields, another engineer can reproduce the start failure without guessing.

Exit codes help, but they do not replace the message. A shell may report 126 for a file that cannot execute and 127 for a command that cannot be found, while runtime-generated failures often surface as 128 or another wrapper code. Treat the code as supporting evidence. The message tail is still the deciding evidence because it names the file, interpreter, mount, hook, or cgroup operation that failed.


4. Entrypoint and command failures in Kubernetes RunContainerError

Entrypoint failures cause RunContainerError when Kubernetes asks the runtime to execute a file that is missing, not executable, or different from the image default. Kubernetes command replaces the image ENTRYPOINT, and args replaces the image CMD. A small manifest override can therefore break a healthy image.

Check what the Pod is actually asking the runtime to run:

bash
kubectl get pod <pod-name> -n <namespace> -o jsonpath='{.spec.containers[0].image}{"\n"}{.spec.containers[0].command}{"\n"}{.spec.containers[0].args}{"\n"}{.spec.containers[0].workingDir}{"\n"}'
kubectl get pod <pod-name> -n <namespace> -o jsonpath='{.spec.containers[0].securityContext}{"\n"}'

Remember the mapping. If command is empty, the image ENTRYPOINT runs. If args is empty, the image CMD runs. If only args is set, the image ENTRYPOINT receives those args. If command is set, the image ENTRYPOINT and CMD are ignored unless you include them yourself. This is where manifests copied from Docker examples often go wrong: command: ["npm"] and args: ["start"] may be correct, while command: ["npm start"] asks the runtime to find one executable literally named npm start.

Kubernetes does not run command through a shell. Shell features such as pipes, redirects, &&, and $HOME expansion need an explicit shell such as sh -c, and the image must contain that shell. Distroless and scratch images often do not. If the runtime message says the executable was not found, inspect the image entrypoint and the Pod override before changing the application.


5. Exec format error in Kubernetes RunContainerError

Exec format error in RunContainerError usually means the kernel cannot execute the file format presented to it. The common production cause is architecture mismatch: an amd64 binary scheduled onto an arm64 node, or an arm64 binary scheduled onto amd64. A missing or wrong shebang can produce a similar start failure for scripts.

Confirm the node architecture and image platform before rebuilding anything:

bash
kubectl get node <node-name> -o jsonpath='{.status.nodeInfo.architecture}{"\n"}{.status.nodeInfo.operatingSystem}{"\n"}'
kubectl get pod <pod-name> -n <namespace> -o jsonpath='{.spec.nodeName}{"\n"}{.spec.containers[0].image}{"\n"}'
docker buildx imagetools inspect <image>

If the image is multi-arch, verify that the manifest list contains the node platform and that the Pod is not pinned to an architecture-specific digest. Digest pinning is good practice, but pinning a single-platform digest in a mixed cluster creates exactly this failure. Prefer a multi-arch tag or digest, and add node affinity or node selectors only when the workload truly supports one architecture.

For scripts, check the first line. A script beginning with #!/bin/bash fails on an image without bash. A script saved with Windows line endings can make the interpreter path look like /bin/sh\r, which the kernel cannot find. The fix is boring and reliable: use a valid shebang, keep line endings as LF, and build the image for every architecture the scheduler can choose.


6. Permission denied in Kubernetes RunContainerError

Permission denied in RunContainerError means the runtime found something to execute but Linux refused the exec or a required file access. The usual causes are a missing execute bit, wrong file ownership for the runtime user, a parent directory without search permission, or a mount mounted with noexec.

Inspect the entrypoint inside the image rather than trusting the Dockerfile:

bash
docker run --rm --entrypoint sh <image> -c 'ls -la /app && ls -l /app/start.sh && id'
docker run --rm --entrypoint ls <image> -l /app/start.sh

For a script, the file needs execute permission for the user that will run it. chmod 744 owned by root is not enough when the container runs as UID 10001 and the others bits do not include execute. Ownership matters as much as mode. Build the image so the runtime user can read and execute the entrypoint, traverse its directories, and read any files the entrypoint needs before the application starts.

Volumes can change the answer after the image is built. A ConfigMap or Secret mounted over a script path may arrive without execute permission unless defaultMode is set correctly. A hostPath or CSI mount may be mounted noexec by policy or node configuration. If the entrypoint lives on a volume, inspect the mounted path and mount options. Do not fix permission failures by running as root unless you have proven the image cannot be corrected; root hides the ownership bug and weakens the Pod security posture.


7. Missing interpreter and shared library failures

Missing interpreter failures look like missing files, but the entrypoint file may exist. When a script starts with #!/usr/bin/env python3, the kernel needs that interpreter path to exist inside the container. When a binary needs a dynamic loader or shared library that the image does not contain, the start can fail before application code runs.

Use image inspection to separate file existence from loader existence:

bash
docker run --rm --entrypoint sh <image> -c 'head -n 1 /app/start.sh; ls -l /bin/sh /usr/bin/env 2>/dev/null || true'
docker run --rm --entrypoint sh <image> -c 'file /app/server && ldd /app/server || true'

Distroless and scratch images are common triggers. A Go binary built with CGO enabled may expect glibc paths that a scratch image does not provide. A Python script copied into a Node image may have a valid shebang for a machine that is not the container. A shell script may assume bash, curl, or jq exists because the build image had them, while the runtime image does not.

The fix belongs in the image contract. Build static binaries where that fits the language, copy required libraries deliberately, or use a runtime base that contains the interpreter the entrypoint names. Avoid adding a shell to a production image only to debug start failures. Use a debug image or ephemeral container for inspection, then fix the production image so its entrypoint can start without tools that are not part of the workload.


8. Working directory and PATH failures

Working directory failures cause RunContainerError when workingDir points to a path that does not exist in the container filesystem or cannot be entered by the runtime user. PATH failures are close cousins: the command name is valid in a developer shell but absent from the image PATH or not installed at all.

Check the Pod spec and image defaults together:

bash
kubectl get pod <pod-name> -n <namespace> -o jsonpath='{.spec.containers[0].workingDir}{"\n"}{.spec.containers[0].command}{"\n"}{.spec.containers[0].args}{"\n"}'
docker image inspect <image> --format '{{.Config.WorkingDir}} {{.Config.Entrypoint}} {{.Config.Cmd}} {{.Config.Env}}'

A relative command such as server depends on PATH. An absolute command such as /app/server depends on the file existing at that path. A script that assumes it starts in /app may fail when workingDir is / and it opens config.yaml by relative path. Some of those failures happen after process start and become application exits, but a missing working directory can stop the runtime before the process begins.

Fix the contract explicitly. Create the working directory in the image, set workingDir to a path that exists, and prefer absolute paths for entrypoints in production manifests. If the application needs writable scratch space, mount an emptyDir at a known path and point the process there. Do not rely on the build machine's current directory or a developer shell PATH.


9. securityContext causes of Kubernetes RunContainerError

securityContext settings can turn a valid image into RunContainerError when the runtime user cannot execute the entrypoint or the Pod policy blocks the start conditions. runAsUser, runAsGroup, runAsNonRoot, supplemental groups, capabilities, seccomp, SELinux options, and readOnlyRootFilesystem all shape the process start environment.

The most common case is ownership. The image entrypoint is owned by root with mode 750, the Pod sets runAsUser: 10001, and the runtime user cannot execute the file. Another case is runAsNonRoot: true with an image whose default user is root and no numeric UID is set; the kubelet refuses the start because it cannot prove the container will run as non-root. A third case is a startup script that writes to the root filesystem while readOnlyRootFilesystem: true is set, although that often becomes an application exit after the shell starts.

Inspect the effective security context at both Pod and container level:

bash
kubectl get pod <pod-name> -n <namespace> -o jsonpath='{.spec.securityContext}{"\n"}{.spec.containers[0].securityContext}{"\n"}'
kubectl explain pod.spec.containers.securityContext

The SecurityContext guide covers the policy side in depth. For RunContainerError, keep the fix narrow: set a numeric non-root user in the image, chown application files to that user, grant execute permission deliberately, and mount writable volumes for paths the process must write. Do not solve a start failure by dropping every security control; that converts an image bug into a cluster risk.


10. Devices, mounts, and runtime start errors

Device and mount failures can surface as RunContainerError when the runtime cannot prepare the container process environment. GPU hooks, device plugins, hostPath mounts, CSI volumes, cgroup writes, and runtime configuration can all fail before the application process starts. The message tail usually names the layer: hook, mount, device, cgroup, or runtime.

Read the event chain in order. If volume mount events failed before container creation, fix storage first. If the container was created and the start failed with a hook error, inspect the runtime hook and device plugin on that node. If only one node fails while other nodes run the same Pod spec, suspect node runtime, kernel, device, or local filesystem state rather than the image.

Use node-level checks carefully and only with platform access:

bash
kubectl get pod <pod-name> -n <namespace> -o wide
kubectl describe node <node-name>
kubectl get events -n <namespace> --field-selector involvedObject.name=<pod-name> --sort-by=.lastTimestamp

On the node, crictl ps -a, crictl inspect, and containerd or CRI-O logs can show whether the failure is repeatable outside Kubernetes. The container internals guide explains the namespace, cgroup, and runc layers behind those messages. Keep the blast radius small: cordon a bad node only when evidence points to the node, and record whether a known-good Pod starts there before blaming the runtime.

A useful comparison is to schedule the same Pod spec on a healthy node with the same architecture and runtime class. If it starts there, the image and Pod spec are probably sound, and the investigation moves to node-local devices, mounts, kernel settings, or runtime configuration. If it fails everywhere with the same tail, stop touching nodes and return to the image contract.


11. Debug the image without guessing

Debugging RunContainerError works best when you reproduce the start outside the failing Deployment. The goal is to prove which file, interpreter, user, directory, or architecture the runtime rejects. Change one variable at a time: image digest, command, user, working directory, node architecture, and mounted volumes.

Start with image metadata and a controlled override:

bash
docker image inspect <image> --format '{{json .Config}}'
kubectl run runcontainer-debug --image=<image> --restart=Never --command -- sleep 3600
kubectl exec -it runcontainer-debug -- sh

If the image has no shell, use an ephemeral debug container or a debug copy of the Pod with a known entrypoint. Inspect /proc/1/root only when you understand the target container filesystem and have permission to debug it. For distroless images, build a temporary debug image from the same application layer plus inspection tools, reproduce the exec failure, then remove the tools from the production image.

A clean reproduction record answers five questions: exact image digest, exact command array, runtime user, working directory, and node architecture. If the same image starts locally but fails in Kubernetes, compare those five values before changing code. The kubectl guide is useful here because most of the evidence comes from describe, get -o jsonpath, events, and controlled debug Pods rather than from application logs.

Preserve the failing Pod long enough to capture events and status. Deleting it immediately may clear the visible symptom while destroying the only copy of the runtime message, restart count, and node placement. In a Deployment, scale or pause the rollout if needed, save the describe output, then replace the Pod after the cause is classified. Evidence first is faster than recreating a failure from memory.


12. Fix patterns in Dockerfile and Pod YAML

Fix RunContainerError at the layer that owns the cause: Dockerfile for file mode, interpreter, architecture, and libraries; Pod YAML for command, args, working directory, user, and mounts; node platform for runtime, device, and cgroup failures. A fix in the wrong layer may clear one Pod and leave the next rollout broken.

For image-owned causes, make the entrypoint contract explicit:

dockerfile
FROM python:3.12-slim
WORKDIR /app
COPY app.py /app/app.py
COPY entrypoint.sh /app/entrypoint.sh
RUN useradd --uid 10001 --create-home appuser \
  && chown -R 10001:10001 /app \
  && chmod 750 /app/entrypoint.sh
USER 10001
ENTRYPOINT ["/app/entrypoint.sh"]

For Pod-owned causes, keep the command array honest:

yaml
apiVersion: v1
kind: Pod
metadata:
  name: api
spec:
  containers:
    - name: api
      image: registry.example.com/api:1.4.2
      workingDir: /app
      command: ["/app/entrypoint.sh"]
      args: ["serve", "--port", "8080"]
      securityContext:
        runAsUser: 10001
        runAsGroup: 10001
        runAsNonRoot: true
        allowPrivilegeEscalation: false
        readOnlyRootFilesystem: true
      volumeMounts:
        - name: tmp
          mountPath: /tmp
  volumes:
    - name: tmp
      emptyDir: {}

Build multi-arch images when the cluster has mixed node architectures. Pin images by digest only when the digest is a multi-arch manifest or the workload is constrained to matching nodes. Add a CI smoke test that starts the image with the same command, user, working directory, and read-only filesystem settings used in production. That test catches most RunContainerError causes before the Deployment does.

Make the smoke test fail on start errors, not only on test assertions. Run the container with the production entrypoint, wait for the process to stay up or emit its ready line, and inspect the exit code if it stops. Repeat the test for every platform in the manifest list. A green unit test suite does not prove the runtime can exec the entrypoint as UID 10001 on an arm64 node.


13. Kubernetes RunContainerError troubleshooting matrix and checklist

The RunContainerError matrix below maps the final runtime clause to the first fix to try. Use it after kubectl describe pod, not instead of it. The status word starts the investigation; the message tail chooses the row, and the row tells you whether the fix belongs in the image, Pod spec, volume, device layer, or node runtime.

Message tail Likely cause First check Fix owner
permission denied Entrypoint not executable or wrong owner ls -l, runtime UID, mount noexec Image or volume
exec format error Wrong CPU architecture or bad shebang Node arch, image platform, first script line Build pipeline
executable file not found in $PATH Command absent or PATH wrong Pod command, image PATH, absolute path Pod spec or image
no such file or directory Missing file, interpreter, loader, or workingDir Entrypoint path, shebang, ldd, workingDir Image or Pod spec
error mounting Bad hostPath, CSI, or volume mount Events, volume source, node path Storage or platform
error running hook Runtime hook or device plugin failure Node device plugin, GPU/runtime logs Platform
failed to write ... memory.max Cgroup or runtime configuration issue Node runtime and kubelet cgroup settings Platform

Final checklist:

  • Copy the full waiting and terminated messages from kubectl describe pod.
  • Record image digest, node name, node architecture, command, args, workingDir, and securityContext.
  • Confirm whether the failure is CreateContainerError, RunContainerError, or CrashLoopBackOff.
  • Inspect the entrypoint file mode, owner, shebang, interpreter, and shared libraries inside the image.
  • Verify the image platform matches every node architecture the scheduler can choose.
  • Reproduce the start with the same user and read-only filesystem settings used in production.
  • Fix the owning layer, rebuild or update the Pod spec, and watch the first replacement Pod reach Running.

Frequently Asked Questions

What does Kubernetes RunContainerError mean?

Kubernetes RunContainerError means the container was created but the runtime could not start its process. The image and scheduling steps usually passed. Read the final runtime clause to find whether the cause is entrypoint, permission, architecture, interpreter, working directory, security context, mount, device, or node runtime.

How is Kubernetes RunContainerError different from CrashLoopBackOff?

RunContainerError is a start failure: the runtime cannot launch the process cleanly. CrashLoopBackOff is the backoff state after repeated failed starts or exits. A container can move from RunContainerError to CrashLoopBackOff, but a CrashLoopBackOff with application logs usually means the process started and then exited.

Why does RunContainerError show permission denied?

Permission denied usually means the entrypoint is not executable by the runtime user, a parent directory blocks traversal, the file owner is wrong, or the entrypoint sits on a noexec mount. Inspect file mode and ownership inside the image, then compare them with runAsUser and mounted volume permissions.

What causes exec format error in Kubernetes RunContainerError?

Exec format error usually means the binary architecture does not match the node, or a script shebang points to an interpreter that cannot run in the image. Check node architecture, image platform manifest, script first line, and line endings. Build multi-arch images for mixed clusters.

Can securityContext cause Kubernetes RunContainerError?

Yes. runAsUser, runAsNonRoot, group settings, capabilities, seccomp, and read-only root filesystem choices can prevent a process from starting or executing its entrypoint. The common case is an entrypoint owned by root while the Pod runs as a non-root UID without execute permission.

Why are there no logs for RunContainerError?

There may be no application logs because the application process never started. Use Pod events, container status messages, image inspection, and node runtime logs instead. If logs exist, read them, but do not assume the application reached its own startup code.

How do I prevent Kubernetes RunContainerError in CI?

Start the image in CI with the same command, args, user, working directory, architecture, and read-only filesystem settings used by the Pod. Check entrypoint mode and shebang during build, publish multi-arch images for mixed clusters, and fail the pipeline when the smoke container cannot reach its expected start state.

⚡ KUBERNETES SCENARIO INTERVIEW PREP

Preparing for Senior Platform & SRE Interviews

Practice real-world cluster triage, RBAC debugging, and pod scheduling scenarios in our Kubernetes scenario interview questions hub.

Explore Interview Scenarios →