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".
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
- Confirm the directory exists relative to the compose file.
- Correct
build.context(anddockerfileif needed). - Re-run the build from the compose file location.
services:
api:
build:
context: ./services/api
dockerfile: DockerfileEnsure the directory is checked out in CI
Fetch submodules or widen the checkout so the build context is present on the runner.
- uses: actions/checkout@v4
with:
submodules: recursiveHow to prevent it
- Keep
build.contextrelative to the compose file and valid. - Check out submodules and all needed paths in CI.
- Validate with
docker compose configbefore building.