moby / moby/buildkit

failed to solve: failed to compute cache key: failed to calculate checksum of ref

Open
#4,128 6 comments 1 reaction 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Go
Stars
10.3k
Forks
1.5k
Avg merge
1d 23h
Merged PRs (30d)
48

Description

I often have builds failing with this error:

failed to solve: failed to compute cache key: failed to calculate checksum of ref pzhz5wxhfuk4nt6gvf90y7xb3::uydm9wxbcjq4otmpf0mm502cn: "/docker-entrypoint.sh": not found

Whereas /docker-entrypoint.sh is just an example. The file exists in the path ./docker/docker-entrypoint.sh and obviously the COPY command of Dockerfile does not even fail?!

After fiddling around for sometimes hours, pruning buildkit-cache and so on, suddenly the build works and I don't even understand what was wrong.

In most cases using pure docker for build even works (without buildkit features), when docker-compose build with buildkit enabled fails!

I would like to understand if this is a bug or just an user unfriendly error-message that leads to wrong understanding the main problem?!

In some cases I think it worked to move the file to be copied in a subfolder like:
./docker/rootfs//docker-entrypoint.boot.sh and modifying COPY to COPY --chmod=a+x ./rootfs/docker-entrypoint.boot.sh /docker-entrypoint.boot.sh

But why doesn't it then work for the path ./docker/docker-entrypoint.boot.sh?!


The Dockerfile-part responsible looks like this f.e.:

COPY --chmod=a+x ./docker-entrypoint.boot.sh /docker-entrypoint.boot.sh

docker-compose.yml (minimal) example:

version: "3.7"

services:
  app-build:
    image: my-app:local
    build:
      context: ./docker
      dockerfile: Dockerfile

In most cases I'm using docker-compose.yml which is in project-root and the docker files are in docker sub-directory:

docker/
  docker-entrypoint.boot.sh
  Dockerfile
docker-compose.yml

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with the minimal Dockerfile and docker-compose.yml example in the issue, using the shown docker/ directory layout. Reproduce the checksum error with BuildKit enabled, then compare it with a non-BuildKit build and the alternate subfolder path. Done means identifying whether the failure is reproducible and whether the error reflects a BuildKit bug or misleading diagnostics.

Written by the indexing model from the issue text.

Assessment

Tech stack
docker, docker-compose
Domain
build-system, devops
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
30/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.