-
Notifications
You must be signed in to change notification settings - Fork 1k
trim-after-delete: handle containers and volumes as well as images #3539
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
Conversation
358054e to
f8b9934
Compare
| log.Printf("An image has been removed: will run the action at least once more") | ||
| action.AtLeastOnceMore() | ||
| } else if event.Action == "destroy" && event.Type == "container" { | ||
| log.Printf("A container has been removed: will run the action at least once more") | ||
| action.AtLeastOnceMore() | ||
| } else if event.Action == "destroy" && event.Type == "volume" { | ||
| log.Printf("A volume has been removed: will run the action at least once more") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Wondering if this will become very noisy (perhaps not a problem, just curious if every even should be logged here, or logging should also be delayed (or only in debug mode)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I've not noticed whether it's a problem in practice or not... but I've not been looking. I'll keep an eye out!
|
(also opened moby/moby#41259 to allow checking for "prune" events, which include pruning the BuildKit build cache) |
|
LGTM |
b684ed8 to
830d70d
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM, but feel free to squash my suggestion commit @djs55
|
Thanks I built the package can you update the examples to use |
We already run the command after an image delete but - a container delete - a volume delete will also free space on the filesystem. Co-authored-by: Sebastiaan van Stijn <github@gone.nl> Signed-off-by: David Scott <dave@recoil.org>
Signed-off-by: David Scott <dave@recoil.org>
55e670b to
1866957
Compare
|
I pushed a separate commit with the example update. Per @thaJeztah 's request I squashed his update into my original patch, hope this is ok! |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Somehow this was never merged. merging now
|
Thanks! |
- What I did
Extended
trim-after-deleteto run the command after a container destroy and volume destroy.- How I did it
We already watch for events, so it's a simple matter to handle the additional container and volume events.
- How to verify it
I run
and then
docker rma container. I see the following output:If I
docker image rman image I see the following output:If I
docker volume rma volume I see the following output:- Description for the changelog
trim-after-delete: run the command also after container destroy and volume destroy.- A picture of a cute animal (not mandatory but encouraged)