diff --git a/daemon/containerd/image_changes.go b/daemon/containerd/image_changes.go index 20c375f5c16035e8bfce492f66eca2b11d913ecd..6cc486ec814be59c022025ef7359c2171d878dca 100644 --- a/daemon/containerd/image_changes.go +++ b/daemon/containerd/image_changes.go @@ -40,7 +40,7 @@ func (i *ImageService) Changes(ctx context.Context, container *container.Contain return nil, err } - snapshotter := i.client.SnapshotService(i.snapshotter) + snapshotter := i.client.SnapshotService(container.Driver) diffIDs := image.RootFS.DiffIDs parent, err := snapshotter.View(ctx, rnd.String(), identity.ChainID(diffIDs).String()) diff --git a/daemon/containerd/image_commit.go b/daemon/containerd/image_commit.go index 7ced28bb9ef3c6309c893fa12871c8f82ec2796c..9c1ceabd092adecaecaacca6dfdedb15dd7c0b3d 100644 --- a/daemon/containerd/image_commit.go +++ b/daemon/containerd/image_commit.go @@ -61,7 +61,7 @@ func (i *ImageService) CommitImage(ctx context.Context, cc backend.CommitConfig) var ( differ = i.client.DiffService() - sn = i.client.SnapshotService(i.snapshotter) + sn = i.client.SnapshotService(container.Driver) ) // Don't gc me and clean the dirty data after 1 hour! @@ -87,7 +87,7 @@ func (i *ImageService) CommitImage(ctx context.Context, cc backend.CommitConfig) } layers := append(manifest.Layers, diffLayerDesc) - commitManifestDesc, err := writeContentsForImage(ctx, i.snapshotter, cs, imageConfig, layers) + commitManifestDesc, err := writeContentsForImage(ctx, container.Driver, cs, imageConfig, layers) if err != nil { return "", err } diff --git a/daemon/containerd/image_exporter.go b/daemon/containerd/image_exporter.go index 59aa1d4ccf3d4b2c5ddeacae7064cac326b6de06..c916a60a95d9c96efdc33a1df71b58e07bad2faf 100644 --- a/daemon/containerd/image_exporter.go +++ b/daemon/containerd/image_exporter.go @@ -22,7 +22,7 @@ import ( ) func (i *ImageService) PerformWithBaseFS(ctx context.Context, c *container.Container, fn func(root string) error) error { - snapshotter := i.client.SnapshotService(i.snapshotter) + snapshotter := i.client.SnapshotService(c.Driver) mounts, err := snapshotter.Mounts(ctx, c.ID) if err != nil { return err diff --git a/daemon/containerd/image_list.go b/daemon/containerd/image_list.go index ac8d9129b5c94684c12baf13be6c22492fafc60f..a175cf85b12d4b3f394846c2774a35894f8db03c 100644 --- a/daemon/containerd/image_list.go +++ b/daemon/containerd/image_list.go @@ -50,6 +50,7 @@ func (i *ImageService) Images(ctx context.Context, opts types.ImageListOptions) return nil, err } + // TODO(thaJeztah): do we need to take multiple snapshotters into account? See https://github.com/moby/moby/issues/45273 snapshotter := i.client.SnapshotService(i.snapshotter) sizeCache := make(map[digest.Digest]int64) snapshotSizeFn := func(d digest.Digest) (int64, error) { @@ -177,6 +178,8 @@ func (i *ImageService) singlePlatformImage(ctx context.Context, contentStore con if err != nil { return nil, nil, err } + + // TODO(thaJeztah): do we need to take multiple snapshotters into account? See https://github.com/moby/moby/issues/45273 snapshotter := i.client.SnapshotService(i.snapshotter) sizeCache := make(map[digest.Digest]int64) diff --git a/daemon/containerd/image_pull.go b/daemon/containerd/image_pull.go index 79bf12f2494290eb906fe8472f7f1cc05d9e2f0b..e9aa62ee1724f48265db2cf114b5365c7dcdabd9 100644 --- a/daemon/containerd/image_pull.go +++ b/daemon/containerd/image_pull.go @@ -62,6 +62,7 @@ func (i *ImageService) PullImage(ctx context.Context, image, tagOrDigest string, defer finishProgress() opts = append(opts, containerd.WithPullUnpack) + // TODO(thaJeztah): we may have to pass the snapshotter to use if the pull is part of a "docker run" (container create -> pull image if missing). See https://github.com/moby/moby/issues/45273 opts = append(opts, containerd.WithPullSnapshotter(i.snapshotter)) // AppendInfoHandlerWrapper will annotate the image with basic information like manifest and layer digests as labels; diff --git a/daemon/containerd/mount.go b/daemon/containerd/mount.go index 012bad23689156c0fb31d8bafa0fa1a5db2d0312..ed58e761dce60eb3bbbd531d51cee39cdae957e5 100644 --- a/daemon/containerd/mount.go +++ b/daemon/containerd/mount.go @@ -13,7 +13,7 @@ import ( // Mount mounts the container filesystem in a temporary location, use defer imageService.Unmount // to unmount the filesystem when calling this func (i *ImageService) Mount(ctx context.Context, container *container.Container) error { - snapshotter := i.client.SnapshotService(i.snapshotter) + snapshotter := i.client.SnapshotService(container.Driver) mounts, err := snapshotter.Mounts(ctx, container.ID) if err != nil { return err diff --git a/daemon/containerd/service.go b/daemon/containerd/service.go index 3021fa9a1cbfced743833bec2cf55c2e7dd539bc..881bab10be660d45d4e278018223650237e403eb 100644 --- a/daemon/containerd/service.go +++ b/daemon/containerd/service.go @@ -128,6 +128,7 @@ func (i *ImageService) ReleaseLayer(rwlayer layer.RWLayer) error { // called from disk_usage.go func (i *ImageService) LayerDiskUsage(ctx context.Context) (int64, error) { var allLayersSize int64 + // TODO(thaJeztah): do we need to take multiple snapshotters into account? See https://github.com/moby/moby/issues/45273 snapshotter := i.client.SnapshotService(i.snapshotter) snapshotter.Walk(ctx, func(ctx context.Context, info snapshots.Info) error { usage, err := snapshotter.Usage(ctx, info.Name) @@ -179,7 +180,7 @@ func (i *ImageService) GetContainerLayerSize(ctx context.Context, containerID st return 0, 0, err } - snapshotter := i.client.SnapshotService(i.snapshotter) + snapshotter := i.client.SnapshotService(ctr.Driver) usage, err := snapshotter.Usage(ctx, containerID) if err != nil { return 0, 0, err