WithSnapshotCleanup deletes the rootfs snapshot allocated for the container
(ctx context.Context, client *Client, c containers.Container)
| 222 | |
| 223 | // WithSnapshotCleanup deletes the rootfs snapshot allocated for the container |
| 224 | func WithSnapshotCleanup(ctx context.Context, client *Client, c containers.Container) error { |
| 225 | if c.SnapshotKey != "" { |
| 226 | if c.Snapshotter == "" { |
| 227 | return fmt.Errorf("container.Snapshotter must be set to cleanup rootfs snapshot: %w", errdefs.ErrInvalidArgument) |
| 228 | } |
| 229 | s, err := client.getSnapshotter(ctx, c.Snapshotter) |
| 230 | if err != nil { |
| 231 | return err |
| 232 | } |
| 233 | if err := s.Remove(ctx, c.SnapshotKey); err != nil && !errdefs.IsNotFound(err) { |
| 234 | return err |
| 235 | } |
| 236 | } |
| 237 | return nil |
| 238 | } |
| 239 | |
| 240 | // WithNewSnapshot allocates a new snapshot to be used by the container as the |
| 241 | // root filesystem in read-write mode |
nothing calls this directly
no test coverage detected
searching dependent graphs…