build-push-action: Workflow hangs with build summary

Contributing guidelines

I’ve found a bug, and:

  • The documentation does not mention anything about my problem
  • There are no open or closed issues that are related to my problem

Description

I updated my workflow to use docker/build-push-action@v6 and the workflow doesn’t finish anymore. It hangs at the Post-Build-Push step.

Expected behaviour

Workflow should finish

Actual behaviour

Workflow hangs at the Post “Build and push” step and times out

Repository URL

No response

Workflow run URL

No response

YAML workflow

name: Publish Docker image
on:
  push:
    branches: [ main ]
  workflow_dispatch:

jobs:
  docker-build-tag-push:
    name: Build and push Docker image to GitHub Registry
    runs-on: self-hosted
    permissions:
      contents: read
      packages: write
      attestations: write
    steps:
      - uses: actions/checkout@v4

      - name: Login to Docker Hub
        uses: docker/login-action@v3
        with:
          registry: ghcr.io
          username: ${{ github.actor }}
          password: ${{ secrets.GITHUB_TOKEN }}

      - name: Set up Docker Buildx
        uses: docker/setup-buildx-action@v3
        with:
          buildkitd-flags: --debug
          driver: kubernetes

      - name: Build and push
        uses: docker/build-push-action@v6
        with:
          context: ./runner
          push: true
          tags: ghcr.io/${{ github.repository }}:latest
          provenance: false
          sbom: false

Workflow logs

Post job cleanup.
Generating build summary
  exporting build record to /home/github/_work/_temp/docker-actions-toolkit-pm5Cga/export
  /usr/bin/mkfifo /home/github/_work/_temp/docker-actions-toolkit-pm5Cga/buildx-in-ODSj6m.fifo
  /usr/bin/mkfifo /home/github/_work/_temp/docker-actions-toolkit-pm5Cga/buildx-out-i0Xvtd.fifo
  docker buildx --builder builder-0cab9f90-307e-4cc5-af4f-e7ed6ff3356a dial-stdio
  docker run --rm -i -v /home/github/.docker/buildx/refs:/buildx-refs -v /home/github/_work/_temp/docker-actions-toolkit-pm5Cga/export:/out docker.io/dockereng/export-build:latest --ref-state-dir=/buildx-refs --node=builder-0cab9f90-307e-4cc5-af4f-e7ed6ff3356a/builder-0cab9f90-307e-4cc5-af4f-e7ed6ff3356a0 --ref=khqxsvwt55emwi9liq51xojq7 --uid=1001 --gid=121
  Unable to find image 'dockereng/export-build:latest' locally
  latest: Pulling from dockereng/export-build
  bb431e31f450: Pulling fs layer
  03f1761d02d6: Pulling fs layer
  03f1761d02d6: Download complete
  bb431e31f450: Verifying Checksum
  bb431e31f450: Download complete
  bb431e31f450: Pull complete
  03f1761d02d6: Pull complete
  Digest: sha256:3dfedea3148487c108965dede834f22e81528fc5b2f3989e4b8ecec2f8fe10ae
  Status: Downloaded newer image for dockereng/export-build:latest
  2024/06/25 14:33:53 failed to fill local state: failed to stat local ref directory /buildx-refs/builder-0cab9f90-307e-4cc5-af4f-e7ed6ff3356a/builder-0cab9f90-307e-4cc5-af4f-e7ed6ff3356a0: stat /buildx-refs/builder-0cab9f90-307e-4cc5-af4f-e7ed6ff3356a/builder-0cab9f90-307e-4cc5-af4f-e7ed6ff3356a0/: no such file or directory
  Warning: Failed to export build record: /home/github/_work/_temp/docker-actions-toolkit-pm5Cga/export/rec.dockerbuild not found
Removing temp folder /home/github/_work/_temp/docker-actions-toolkit-9M2Ath
Post cache
  State not set

BuildKit logs

No response

Additional info

No response

About this issue

  • Original URL
  • State: closed
  • Created 2 years ago
  • Reactions: 4
  • Comments: 37 (14 by maintainers)

Commits related to this issue

Most upvoted comments

We are relying on docker run to export the build record which might have unexpected behavior in a DinD container or if docker context is not local.

https://github.com/docker/buildx/issues/2711 would solve this issue by eliminating the dependency on docker cli.

In the meantime you can disable summary with DOCKER_BUILD_SUMMARY: false if that disrupts your workflow:

      -
        name: Build and push
        uses: docker/build-push-action@v6
        with:
          push: true
          tags: user/app:latest
        env:
          DOCKER_BUILD_SUMMARY: false

My problems went away when I switched to the “Actions Runner Controller” and from my custom runner image to the official image as the base for my runner like this:

FROM ghcr.io/actions/actions-runner:2.319.1

Docker is already included in that image. Also service container now work as well.

I also switched to the default docker driver for my cluster:

- name: Set up Docker Buildx
  uses: docker/setup-buildx-action@v3

Instead of driver: kubernetes before.

I’m pretty sure it already happend with 26.1.4 … sorry 😦

There are some ARGs and ENVs I left out (and also just tried without)