mirror of
https://github.com/linuxkit/linuxkit.git
synced 2025-07-19 17:26:28 +00:00
Merge pull request #3539 from djs55/trim-after-delete-container
trim-after-delete: handle containers and volumes as well as images
This commit is contained in:
commit
e48d5294ee
@ -75,7 +75,7 @@ services:
|
||||
command: ["/vpnkit-forwarder", "-vsockPort", "62373"]
|
||||
# Monitor for image deletes and invoke a TRIM on the container filesystem
|
||||
- name: trim-after-delete
|
||||
image: linuxkit/trim-after-delete:v0.8
|
||||
image: linuxkit/trim-after-delete:6258aec13d91259379289b577f8a79754819777e
|
||||
# When the host resumes from sleep, force a clock resync
|
||||
- name: host-timesync-daemon
|
||||
image: linuxkit/host-timesync-daemon:v0.8
|
||||
|
@ -15,7 +15,7 @@ import (
|
||||
"time"
|
||||
)
|
||||
|
||||
// Listen for Docker image delete events and run a command after a delay.
|
||||
// Listen for Docker image, container, and volume delete events and run a command after a delay.
|
||||
|
||||
// Event represents the subset of the Docker event message that we're
|
||||
// interested in
|
||||
@ -136,7 +136,13 @@ RECONNECT:
|
||||
continue RECONNECT
|
||||
}
|
||||
if event.Action == "delete" && event.Type == "image" {
|
||||
log.Printf("The delayed action will happen at least once more")
|
||||
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")
|
||||
action.AtLeastOnceMore()
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user