Skip to content

Unable to complete build for a multi-stage Dockerfile when using caching #259

Open
@jamesdh

Description

@jamesdh

Behaviour

Unable to complete the build for a multi-stage Dockerfile, regardless if registry (GitHub Container Registry) or local (actions/cache@v2) cache is used. No error, the process just freezes after "preparing build cache for export" finishes. Build works just fine if the cache arguments are removed. Adding debug flag doesn't appear to show any additional information.

Steps to reproduce this issue

  1. Define a multi-stage Dockerfile
  2. Utilize build-push-action with either a local or registry based cache
  3. Execute

Expected behaviour

Cache export finishes, remainder of workflow completes, and subsequent builds are able to utilize the cache to speed up docker build times

Actual behaviour

Jobs become "stuck" after "preparing build cache for export x.xs done" and never complete until manually terminated.

Configuration

- name: Cache Docker layers
  uses: actions/cache@v2
  with:
    path: /tmp/.buildx-cache
    key: ${{ runner.os }}-buildx-${{ github.sha }}
    restore-keys: |
      ${{ runner.os }}-buildx-

- name: Set up Docker Buildx
  uses: docker/setup-buildx-action@v1
  with:
    install: true

- name: Build and push
  uses: docker/build-push-action@v2
  with:
    version: latest
    buildkitd-flags: --debug
    # cache-from: type=registry,ref=ghcr.io/moltenbits/tt-grails
    # cache-to: type=registry,ref=ghcr.io/moltenbits/tt-grails,mode=max
    cache-from: type=local,src=/tmp/.buildx-cache
    cache-to: type=local,dest=/tmp/.buildx-cache
    context: ./back
    file: ./back/Dockerfile.prod
    push: true
    tags: ghcr.io/moltenbits/tt-grails:latest    

Logs

2020-12-19T15:00:41.5394086Z 26 exporting to image
2020-12-19T15:00:41.5394602Z 26 exporting layers
2020-12-19T15:00:59.2386163Z 26 exporting layers 17.8s done
2020-12-19T15:00:59.3887834Z 26 exporting manifest sha256:5be4d8e3cf7172c58e4927f5427b59fab979257d21a3854a2c22f6e1338f7079 done
2020-12-19T15:00:59.3889617Z 26 exporting config sha256:c692c40f701bdebf651c9ea5bf8bf5bf23bf0b579834a63a54b885b9fc0114e7 done
2020-12-19T15:00:59.3890857Z 26 pushing layers
2020-12-19T15:01:04.1877777Z 26 pushing layers 4.9s done
2020-12-19T15:01:04.1879183Z 26 pushing manifest for ghcr.io/moltenbits/tt-grails:latest
2020-12-19T15:01:05.0884514Z 26 pushing manifest for ghcr.io/moltenbits/tt-grails:latest 0.8s done
2020-12-19T15:01:05.0885197Z 26 DONE 23.5s
2020-12-19T15:01:05.0885485Z
2020-12-19T15:01:05.0885893Z 27 exporting cache
2020-12-19T15:01:05.0886406Z 27 preparing build cache for export
2020-12-19T15:01:05.9889797Z 27 preparing build cache for export 0.9s done
2020-12-19T15:22:19.4836222Z ##[error]The operation was canceled.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions