Skip to content
Latchkey

Compose "build path ... either does not exist" in CI

A service with a build: context tells Compose where the Dockerfile and build files live. If that path does not exist relative to the compose file, Compose cannot start the build and stops before invoking BuildKit.

What this error means

A docker compose build or up --build fails with "build path /home/runner/work/app/app/service either does not exist, is not accessible, or is not a valid URL".

compose
service "api" refers to undefined build path ./service:
build path /home/runner/work/app/app/service either does not exist,
is not accessible, or is not a valid URL.

Common causes

The context path is wrong relative to the compose file

The build.context is resolved relative to the compose file directory; a path that does not match the repo layout points nowhere.

The directory was not checked out

A submodule or sparse checkout left the build context directory absent in CI.

How to fix it

Point the context at the real directory

  1. Confirm the directory exists relative to the compose file.
  2. Correct build.context (and dockerfile if needed).
  3. Re-run the build from the compose file location.
docker-compose.yml
services:
  api:
    build:
      context: ./services/api
      dockerfile: Dockerfile

Ensure the directory is checked out in CI

Fetch submodules or widen the checkout so the build context is present on the runner.

.github/workflows/ci.yml
- uses: actions/checkout@v4
  with:
    submodules: recursive

How to prevent it

  • Keep build.context relative to the compose file and valid.
  • Check out submodules and all needed paths in CI.
  • Validate with docker compose config before building.

Frequently asked questions

What causes ""build path ... either does not exist""?
The build.context is resolved relative to the compose file directory; a path that does not match the repo layout points nowhere.
How do I fix "build path ... either does not exist"?
Point the context at the real directory

Related guides

References

Latchkey auto-heals failures like this one - detected, fixed, and retried without you. Start free → 30-day trial · No credit card