Skip to content
Latchkey

Docker "failed to create shim task" runtime error in CI

containerd starts each container through a shim process that manages the OCI task. When the shim cannot be created - a transient containerd hiccup, a missing or broken runc, or resource pressure spawning the process - the container fails to start with failed to create shim task. The transient form clears on retry; a structural one (missing runtime) does not.

What this error means

A container start fails with Error response from daemon: failed to create shim task. Sometimes a wrapped OCI runtime message follows.

docker
docker: Error response from daemon: failed to create shim task: OCI runtime create failed: unable to start container process: error during container init

Diagnose it: read the container, not the compose file

A container that exits immediately in CI has almost always logged the reason and then been cleaned up. Capture the logs and the exit code before changing configuration.

Terminal
# why did it stop?
docker ps -a --format '{{.Names}}\t{{.Status}}\t{{.Image}}'
docker logs <container> 2>&1 | tail -50
docker inspect <container> --format '{{.State.ExitCode}} {{.State.OOMKilled}} {{.State.Error}}'

Common causes

A transient containerd/shim spawn failure

Resource pressure or a momentary containerd issue can fail the shim creation for one start.

A missing or broken OCI runtime

If runc is absent or incompatible, every shim/task creation fails - that is structural, not transient.

How to fix it

Re-run the container start

  1. Retry - a one-off shim creation failure is usually transient.
  2. If it recurs every time, the runtime is broken (see next fix).
Terminal
docker run --rm myorg/api:1.4.2

Verify the OCI runtime is installed

  1. Confirm runc is present and runnable.
  2. Reinstall the runtime if it is missing or broken.
Terminal
runc --version
docker info | grep -i runtime

How to prevent it

  • Keep containerd and runc healthy and up to date.
  • Avoid host resource exhaustion during heavy container churn.
  • Retry transient shim-task failures before deeper debugging.

Frequently asked questions

What causes Docker "failed to create shim task" runtime error in CI?
There are 2 common causes: a transient containerd/shim spawn failure and a missing or broken oci runtime. Resource pressure or a momentary containerd issue can fail the shim creation for one start.
How do I fix Docker "failed to create shim task" runtime error in CI?
There are 2 fixes depending on which cause you have: re-run the container start and verify the oci runtime is installed. Work through them in order, since the first is the most common.
What does Docker "failed to create shim task" runtime error in CI actually mean?
A container start fails with Error response from daemon: failed to create shim task.
How do I stop Docker "failed to create shim task" runtime error in CI happening again?
Keep containerd and runc healthy and up to date. The prevention section lists 3 changes that keep it from recurring.

Related guides

References

Not every red build is your code. Latchkey repairs the ones that are not, on the runner. Start free → 30-day trial · No credit card