docker / build-push-action

GitHub Action to build and push Docker images with Buildx
https://github.com/marketplace/actions/build-and-push-docker-images
Apache License 2.0
4.24k stars 541 forks source link

ERROR: failed to calculate checksum of ref ... no such file or directory #910

Closed theAkito closed 1 year ago

theAkito commented 1 year ago

Behaviour

Catching up on https://github.com/docker/build-push-action/issues/558#issuecomment-1646352705.

Steps to reproduce this issue

https://github.com/theAkito/docker-murmur/blob/master/.github/workflows/docker-build-push-app-buster-slim.yml

Expected behaviour

Process should complete successfully.

Actual behaviour

Internal Docker processing does not complete successfully, leading to failed Docker builds.

Configuration

name: Docker Image Build and Push

on:
  push:
    branches:
      - master
    tags:
      - "*.*.*"
  pull_request:

jobs:

  build-push:

    runs-on: ubuntu-latest
    steps:
      - name: Checkout
        uses: actions/checkout@v3

      - name: Git Metadata for Docker
        id: meta
        uses: docker/metadata-action@v4
        with:
          images: |
            akito13/murmur
          flavor: |
            latest=true
            prefix=
            suffix=
          tags: |
            type=edge,branch=master
            type=raw,value=buster-slim
            type=schedule
            type=ref,event=branch
            type=ref,event=pr
            type=semver,pattern={{version}}
            type=semver,pattern={{major}}.{{minor}}
            type=semver,pattern={{major}}
            type=sha,prefix=,format=long

      - name: Set up QEMU
        uses: docker/setup-qemu-action@v2

      - name: Set up Docker BuildX
        uses: docker/setup-buildx-action@v2

      - name: Login to DockerHub
        uses: docker/login-action@v2
        with:
          username: ${{ secrets.DOCKERHUB_USERNAME }}
          password: ${{ secrets.DOCKERHUB_TOKEN }}

      - name: Build and push
        uses: docker/build-push-action@v3
        with:
          context: .
          platforms: linux/arm/v7,linux/arm64/v8,linux/amd64
          push: ${{ github.event_name != 'pull_request' }}
          tags: ${{ steps.meta.outputs.tags }}
          labels: ${{ steps.meta.outputs.labels }}

Logs

logs_9.zip

Additional Context

https://github.com/dotnet/dotnet-docker/discussions/4716

crazy-max commented 1 year ago

https://github.com/theAkito/docker-murmur/actions/runs/5627573725/job/15250407075#step:7:6824

#24 [linux/amd64 stage-1 5/6] COPY --from=build /root/mumble/release/murmurd /usr/bin/murmurd
#24 ERROR: failed to calculate checksum of ref qgp9ucmtmblbgry83pja48n5y::8myxzhj2gtzqfcqjue0dzjw4i: failed to walk /tmp/buildkit-mount2545155800/root/mumble/release: lstat /tmp/buildkit-mount2545155800/root/mumble/release: no such file or directory

It looks similar to https://github.com/docker/buildx/issues/1899.

Do you repro locally with:

# create container builder to be able to build a multiplatform image
$ docker buildx create --name mybuilder --bootstrap
# build
$ docker buildx --builder mybuilder build --platform linux/arm/v7,linux/arm64/v8,linux/amd64 .
theAkito commented 1 year ago

@crazy-max

Locally, I'm getting the following.

ERROR: failed to solve: failed to compute cache key: failed to calculate checksum of ref qu9hjqz890ej8kf870640mbq4::8ggpgykihnibeuqu4btxyqu2p: failed to walk /tmp/buildkit-mount1844446442/root/mumble/release: lstat /tmp/buildkit-mount1844446442/root/mumble/release: no such file or directory
crazy-max commented 1 year ago

Ok can you change this step to enable BuildKit container logs:

      - name: Set up Docker BuildX
        uses: docker/setup-buildx-action@v2
        with:
          buildkitd-flags: --debug

That could be useful to us.

theAkito commented 1 year ago

After debugging the issue locally, I came to the conclusion that it was a mistake in the configuration of the Dockerfile, where a file was there before, but in a new version of the deployed app it's not there, anymore. Hence, "no such file or directory".

However, I must emphasise, that the error is very unintuitive & should be more clear.

Is this something that would be reported on moby or where would that be accomplished?

As for this specific issue at hand, it can be considered resolved for all I expected.

crazy-max commented 1 year ago

However, I must emphasise, that the error is very unintuitive & should be more clear.

We have made some enhancements related to this such as https://github.com/moby/buildkit/pull/3990

Just of curiosity, could you try with latest 0.12.0 of BuildKit?:

      - name: Set up Docker BuildX
        uses: docker/setup-buildx-action@v2
        with:
          driver-opts: |
            image=moby/buildkit:v0.12.0
          buildkitd-flags: --debug
theAkito commented 1 year ago

@crazy-max

Success. 🙂

https://github.com/theAkito/docker-murmur/actions/runs/5650350467/job/15306545208#step:7:12741

DeniroBlack commented 6 months ago

Downgrade docker on windows helps to me