8000 Documentation for builder prune. by adeniyistephen · Pull Request #2864 · docker/cli · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

Documentation for builder prune. #2864

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 7 commits into
base: master
Choose a base branch
from

Conversation

adeniyistephen
Copy link

- What I did
Documentation of builder prune with its inputs and examples for #2325
- How I did it

- How to verify it

- Description for the changelog

- A picture of a cute animal (not mandatory but encouraged)

@codecov-io
Copy 8000 link
codecov-io commented Dec 6, 2020

Codecov Report

Merging #2864 (844643a) into master (dca98e3) will not change coverage.
The diff coverage is n/a.

@@           Coverage Diff           @@
##           master    #2864   +/-   ##
=======================================
  Coverage   57.08%   57.08%           
=======================================
  Files         297      297           
  Lines       18642    18642           
=======================================
  Hits        10642    10642           
  Misses       7141     7141           
  Partials      859      859           

@adeniyistephen
Copy link
Author

@thaJeztah @tiborvass PTAL

@thaJeztah
Copy link
Member

@tiborvass PTAL 🤗

@thaJeztah
Copy link
Member

oh, and probably @tonistiigi ptal

@usha-mandya
Copy link
Member

@tonistiigi @thaJeztah Could you PTAL?

@thaJeztah
Copy link
Member

@docker/build PTAL

@crazy-max
Copy link
Member

Nice docs! Looking at #3314, I wonder if this should not be moved to https://github.com/docker/buildx/blob/master/docs/reference/buildx_prune.md?

@tonistiigi
Copy link
Member

@crazy-max Agree for the prune command. For the garbage collection, maybe somewhere around https://docs.docker.com/engine/reference/commandline/dockerd/ but @thaJeztah knows better.

So docker try to remove the cache that is less likely to be used in future builds to keep builds as fast as possible while maintaining cache size under control.

**Note**
>Pruning does not works if the Total is below what you specified as keep storage option to prune. It needs to go above, we are
Copy link

Choose a reason for hiding this comment

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

Misspelled "works". Should be "does not work if".

@vbezhenar
Copy link

I don't really understand last example.

"gc": {
      "enabled": true,
      "policy": [
            {"keepStorage": "10GB", "filter": ["unused-for=2200h"]},
            {"keepStorage": "50GB", "filter": {"unused-for": {"3300h": true}}},
            {"keepStorage": "100GB", "all": true}
        ]
    }

if the build cache is more than 10GB delete every unused build cache that are more than 92 days old

next rule should remove every cache that are more than 136 days old

If we already deleted every unused build cache that's more than 92 days old, there should not be any caches left which are more than 136 days old. It's confusing.

@dvdksn
Copy link
Contributor
dvdksn commented Dec 14, 2022

Looks like the GC docs are now already mostly covered on this page in docs; https://docs.docker.com/build/cache/garbage-collection/

Would be nice to merge the description for prune though.

}
}
```
The garbage collection config file can be created incase you dont have one located in your `etc/docker` folder, and if you do have

Choose a reason for hiding this comment

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

Seems to be 'in case' instead of 'incase' here?

@codecov-commenter
Copy link

Codecov Report

Merging #2864 (844643a) into master (dca98e3) will not change coverage.
The diff coverage is n/a.

❗ Current head 844643a differs from pull request most recent head 9f542d1. Consider uploading reports for the commit 9f542d1 to get more accurate results

Additional details and impacted files
@@           Coverage Diff           @@
##           master    #2864   +/-   ##
=======================================
  Coverage   57.08%   57.08%           
=======================================
  Files         297      297           
  Lines       18642    18642           
=======================================
  Hits        10642    10642           
  Misses       7141     7141           
  Partials      859      859           

@bdrnglm
Copy link
bdrnglm commented Jul 27, 2023

Why is this not merged yet ?

08unho1rnguz regular 2.38MB 13 days ago 13 days ago 1 false
i8nfk2fvpyyi regular 0B 2 weeks ago 13 days ago 2 false

$ docker builder prune --filter until=24h # to remove builder cache with a filter or 24 hours
Copy link

Choose a reason for hiding this comment

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

it should be "with a filter of 24 hours"

adeniyistephen and others added 4 commits April 22, 2025 19:01
Signed-off-by: adeniyistephen <adeniyistadz@gmail.com>
Signed-off-by: adeniyistephen <adeniyistadz@gmail.com>
Signed-off-by: adeniyistephen <adeniyistadz@gmail.com>
@adeniyistephen
Copy link
Author

I don't really understand last example.

"gc": {
      "enabled": true,
      "policy": [
            {"keepStorage": "10GB", "filter": ["unused-for=2200h"]},
            {"keepStorage": "50GB", "filter": {"unused-for": {"3300h": true}}},
            {"keepStorage": "100GB", "all": true}
        ]
    }

if the build cache is more than 10GB delete every unused build cache that are more than 92 days old

next rule should remove every cache that are more than 136 days old

If we already deleted every unused build cache that's more than 92 days old, there should not be any caches left which are more than 136 days old. It's confusing.

Thanks @vbezhenar cleaned up and a more clearer version.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

0