docker / docker/build-push-action
Unable to complete build for a multi-stage Dockerfile when using caching
Nobody has claimed this yet.
- Dominant language
- TypeScript
- Stars
- 5.4k
- Forks
- 735
- Avg merge
- 3d 9h
- Merged PRs (30d)
- 14
Description
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
- Define a multi-stage Dockerfile
- Utilize build-push-action with either a local or registry based cache
- 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.
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start with the workflow configuration using docker/setup-buildx-action@v1 and docker/build-push-action@v2, including the multi-stage ./back/Dockerfile.prod and local or registry cache settings. Reproduce the build and inspect where it stops after “preparing build cache for export”; done means the workflow completes and a subsequent build can use the cache.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- docker, github-actions, typescript
- Domain
- build-system, ci-cd, devops
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100