buildx: The cache export step hangs
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:
About this issue
- Original URL
- State: open
- Created 6 years ago
- Reactions: 37
- Comments: 15 (4 by maintainers)
Any fix?
What we found about this issue has been summarized in a blog post: https://tech.sparkfabrik.com/en/blog/docker-cache-deep-dive/ – we found that it was all related to compression.
@tonistiigi Unfortunately, grpc/grpc-go#4722 was closed as stale. At this point, our cache exports are so slow, that we might as well not use docker caching at all.
I have a similar issue. It doesn’t happen all the time, and I’m not sure what triggers it so I can’t give a reproducer. The build fully uses the
--cache-from(all steps are marked asCACHED), which points to the same registry&image&tag as--cache-to, so I don’t think anything actually needs to be pushed.Deleting the
--cache-totag from the registry allows the next build to succeed.Sorry, I don’t have much more information.
I have been trying to figure out for the entire day why a simple docker buildx filesystem export hangs in GitHub Actions, while it works just fine locally in WSL2. Maybe this is the same issue? https://twitter.com/awakecoding/status/1430252223771054084