Skip to content

Commit 2f165c4

Browse files
authored
Merge pull request docker-library#16715 from infosiftr/buildkit-gc
Re-enable BuildKit "Garbage Collection"
2 parents 8474e90 + 8214476 commit 2f165c4

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

.bin/docker-buildx-ensure.sh

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -38,18 +38,20 @@ read -r -d '' buildkitdConfig <<-EOF || :
3838
3939
[worker.oci]
4040
platforms = [ "$platform" ]
41-
gc = false # we want to do GC manually
4241
4342
# this should be unused (for now?), but included for completeness/safety
4443
[worker.containerd]
4544
platforms = [ "$platform" ]
4645
namespace = "buildkit-$builderName"
47-
gc = false
4846
4947
[registry."docker.io"]
5048
mirrors = $hubMirrors
5149
EOF
5250

51+
# Ideally, we would also disable BuildKit's garbage collection here too, especially because we happen to be able to know exactly the set of built images for whom cache should be kept (and everything else is ripe for deletion).
52+
# In practice however, this is far too cumbersome to manage correctly, especially as we have had to dramatically change the way we perform these builds over time such that this is no longer reasonable.
53+
# As such, we now rely on BuildKit's default policies instead: https://docs.docker.com/build/cache/garbage-collection/#default-policies
54+
5355
# https://docs.docker.com/engine/reference/commandline/buildx_create/
5456
args=(
5557
--name "$builderName"

0 commit comments

Comments
 (0)