The cache export step hangs
Nobody has claimed this yet.
- Dominant language
- Go
- Stars
- 4.5k
- Forks
- 682
- Avg merge
- 2d 14h
- Merged PRs (30d)
- 29
Description
Hi,
first of all, sorry if this is a double post, but since the other reports I found are a kite old and without recent activity, I decided/try to sum it all here:
Looks like the "preparing build cache for the export" step is hanging pointing to some kind of bug here:

In my last tries, it had more than 1h, no CPU usage, just stuck. Meaning that beside inline cache type, the others are unusable.
How to reproduce:
- dockerfile with multistage build
- cache-to with local or registry type with mode default/max
- first export will work well, however in the second run (maybe due cache-from) it will hang up infinitely
notes:
- I also used a multi-platform build but I don't think it's related
- tested in a GitLab CI pipeline
Samples
Here is the build commands that i used with just some redacted commands:
local type:
- docker buildx build
--cache-from=type=local,src=docker_cache/
--cache-to=type=local,dest=docker_cache/
--ssh default=...
--output type=image,name=registry.dev:foo,push=true
--platform=linux/amd64,linux/arm,linux/arm64
.
registry type:
- docker buildx build
--cache-from=type=registry,ref=registry.dev/cache
--cache-to=type=registry,ref=registry.dev/cache
--ssh default=...
--output type=image,name=registry:foo,push=true
--platform=linux/amd64,linux/arm,linux/arm64
.
Other reports that might be related:
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 by reproducing the hang with a multistage Dockerfile and the local or registry cache-to/cache-from commands shown in the issue, comparing the first and second exports. Read the related reports in moby/buildkit#1704 and docker/buildx#237; done means the second export completes instead of hanging indefinitely.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- docker, dockerfile, go
- Domain
- build-system, devops
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100