mirror of
https://github.com/moby/moby.git
synced 2026-07-13 02:52:20 +00:00
Add label on PrepareSnapshot to warn about non-expiring leases
Currently when preparing a snapshot for a container, a lease is used to hold that snapshot for the lifespan of a container. That is workaround to preserve the snapshot when a container is recreated, however, the containerd object should be able to hold this reference itself. Signed-off-by: Derek McGowan <derek@mcg.dev>
This commit is contained in:
@@ -55,6 +55,11 @@ func (i *ImageService) PrepareSnapshot(ctx context.Context, id string, parentIma
|
||||
parentSnapshot = identity.ChainID(diffIDs).String()
|
||||
}
|
||||
|
||||
// TODO: Consider a better way to do this. It is better to have a container directly
|
||||
// reference a snapshot, however, that is not done today because a container may
|
||||
// removed and recreated with nothing holding the snapshot in between. Consider
|
||||
// removing this lease and only temporarily holding a lease on re-create, using
|
||||
// non-expiring leases introduces the possibility of leaking resources.
|
||||
ls := i.client.LeasesService()
|
||||
lease, err := ls.Create(ctx, leases.WithID(id))
|
||||
if err != nil {
|
||||
|
||||
Reference in New Issue
Block a user