diff --git a/daemon/containerd/image_changes.go b/daemon/containerd/image_changes.go index 20c375f5c1..6cc486ec81 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 7ced28bb9e..9c1ceabd09 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 59aa1d4ccf..c916a60a95 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 ac8d9129b5..a175cf85b1 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 79bf12f249..e9aa62ee17 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 012bad2368..ed58e761dc 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 3021fa9a1c..881bab10be 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