Skip to content
Latchkey

GitHub Actions container job "workdir not found"

A container job passed a --workdir via container.options that the image filesystem does not contain. Docker refuses to start the container with a working directory that does not exist.

What this error means

The "Initialize containers" phase fails referencing a workdir path that is absent from the image.

github-actions
##[error]failed to create task for container: failed to create shim task: OCI runtime create failed: runc create failed: unable to start container process: chdir to cwd ("/app/build") set in config.json failed: no such file or directory

Common causes

options --workdir points at a missing path

container.options included "--workdir /app/build" but the image never creates /app/build, so the container cannot chdir into it.

Confusing container workdir with the workspace

The runner mounts the repo at GITHUB_WORKSPACE automatically; overriding --workdir to a nonexistent path breaks that default.

How to fix it

Drop the override or point at an existing dir

  1. Remove the --workdir option and let the runner use the default workspace mount.
  2. If you need a custom workdir, choose a path that exists in the image (or create it via working-directory on the step).
  3. Re-run.
.github/workflows/ci.yml
jobs:
  build:
    runs-on: ubuntu-latest
    container:
      image: node:20-bookworm
    steps:
      - uses: actions/checkout@v4
      - run: npm ci
        working-directory: .

How to prevent it

  • Avoid overriding --workdir unless the image guarantees the path exists.
  • Use step-level working-directory for per-step paths instead of container options.

Related guides

Tired of flaky CI? Latchkey auto-heals failed jobs and retries them for you. Start free →