Repository navigation
fix(docker): NuGet cache mount breaks parallel and pruned builds - #839
Merged
Merged
Conversation
Two problems with the cache mount from #836: - Compose builds the API and Worker at once, and both restored into the shared `nuget` mount. NuGet keeps its extraction locks in each container's own /tmp, so the two restores deleted each other's temp files: "Could not find file '/root/.nuget/packages/serilog/4.4.0/ zzhu1xit.trf'". sharing=locked makes them take turns. - BuildKit's layer cache ignores the mount, so the restore layer can be reused after the mount was evicted or pruned. `publish --no-restore` then failed with NETSDK1064. publish now restores itself, which is a quick check when the packages are already there. Reproduced both with `docker compose -f docker-compose.yml -f docker-compose.build.yml build --no-cache api worker` and a fresh mount id: 4 of 4 rounds failed before, 4 of 4 pass after. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Follow-up to #836. Building with
docker-compose.build.yml(as on Unraid) failed indotnet restore:Causes
nugetcache mount, which BuildKit shares between builds by default. NuGet guards package extraction with lock files in/tmp, but each build container has its own/tmp, so the two restores remove each other's temp files.sharing=lockedmakes concurrent builds take turns on the mount.docker builder prune) it can still reuse the restore layer.publish --no-restorethen fails withNETSDK1064: Package ... was not found.publishnow restores itself: a quick check when the packages are there, a download when they are not.The same applies to the all-in-one Dockerfile. The images themselves do not change.
Checked
docker compose -f docker-compose.yml -f docker-compose.build.yml build --no-cache api worker, with a fresh mount id each round, failed in 4 of 4 rounds with the same error.publishrestores and the build succeeds.🤖 Generated with Claude Code