Skip to content

Conversation

@dvdksn
Copy link
Contributor

@dvdksn dvdksn commented Dec 12, 2024

Revise the documentation for build GC and configuring GC policies.

Also updates the configuration to describe the new GC config options.

Preview: https://deploy-preview-21617--docsdocker.netlify.app/build/cache/garbage-collection/

Related issues

@dvdksn dvdksn requested a review from crazy-max as a code owner December 12, 2024 13:35
@dvdksn dvdksn requested a review from tonistiigi December 12, 2024 13:35
@github-actions github-actions bot added the area/build Relates to Dockerfiles or docker build command label Dec 12, 2024
@netlify
Copy link

netlify bot commented Dec 12, 2024

Deploy Preview for docsdocker ready!

Name Link
🔨 Latest commit 841ca61
🔍 Latest deploy log https://app.netlify.com/sites/docsdocker/deploys/675c10d7aa02e7000813490c
😎 Deploy Preview https://deploy-preview-21617--docsdocker.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify site configuration.

If you're using the [`docker` driver](../builders/drivers/docker.md), garbage collection
can be configured in the [Docker Daemon configuration](/reference/cli/dockerd.md#daemon-configuration-file).
file:
1. Remove ephemeral, unused build cache older than 48 hours if it exceeds 10%
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🙃

https://github.com/moby/moby/blob/d60e55d613a35a11d59310a1ec16eb06f2133eb1/builder/builder-next/worker/gc.go#L12-L15

Suggested change
1. Remove ephemeral, unused build cache older than 48 hours if it exceeds 10%
1. Remove ephemeral, unused build cache older than 48 hours if it exceeds 13.8%

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

// tempCachePercent represents the percentage ratio of the cache size in bytes to temporarily keep for a short period of time (couple of days)
// over the total cache size in bytes. Because there is no perfect value, a mathematically pleasing one was chosen.
// The value is approximately 13.8
const tempCachePercent = math.E * math.Pi * math.Phi

https://github.com/moby/moby/blob/d60e55d613a35a11d59310a1ec16eb06f2133eb1/builder/builder-next/worker/gc.go#L12-L15

lol

@dvdksn dvdksn requested a review from a team December 12, 2024 15:32
}
```

The `defaultKeepStorage` option configures the size limit of the build cache,
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

From BuildKit v0.17 and moby/moby#48720 these defaults are different with reserved,free,max all being configured by default.

Signed-off-by: David Karlsson <35727626+dvdksn@users.noreply.github.com>
@dvdksn dvdksn merged commit 3c89073 into docker:main Dec 18, 2024
14 checks passed
@dvdksn dvdksn deleted the build-gcconfig branch December 18, 2024 08:38
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area/build Relates to Dockerfiles or docker build command status/review

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Explain how to set GC policy GC policies do not mention how often pruning is done or how it works.

4 participants