From 51f5b1279d6cfff2bb97351aee84e82397a71644 Mon Sep 17 00:00:00 2001 From: Brian Goff Date: Thu, 5 Nov 2020 21:50:54 +0000 Subject: [PATCH] Don't set image on containerd container. We aren't using containerd's image store, so we shouldn't be setting this value. This fixes container checkpoints, where containerd attempts to checkpoint the image since one is set, but the image does not exist in containerd. Signed-off-by: Brian Goff --- daemon/start.go | 19 ++----------------- 1 file changed, 2 insertions(+), 17 deletions(-) diff --git a/daemon/start.go b/daemon/start.go index 049eb686e2..d9bc082b10 100644 --- a/daemon/start.go +++ b/daemon/start.go @@ -5,9 +5,6 @@ import ( "runtime" "time" - "github.com/containerd/containerd" - "github.com/containerd/containerd/containers" - "github.com/docker/distribution/reference" "github.com/docker/docker/api/types" containertypes "github.com/docker/docker/api/types/container" "github.com/docker/docker/container" @@ -181,12 +178,7 @@ func (daemon *Daemon) containerStart(container *container.Container, checkpoint ctx := context.TODO() - imageRef, err := reference.ParseNormalizedNamed(container.Config.Image) - if err != nil { - return err - } - - err = daemon.containerd.Create(ctx, container.ID, spec, shim, createOptions, withImageName(imageRef.String())) + err = daemon.containerd.Create(ctx, container.ID, spec, shim, createOptions) if err != nil { if errdefs.IsConflict(err) { logrus.WithError(err).WithField("container", container.ID).Error("Container not cleaned up from containerd from previous run") @@ -195,7 +187,7 @@ func (daemon *Daemon) containerStart(container *container.Container, checkpoint if err := daemon.containerd.Delete(ctx, container.ID); err != nil && !errdefs.IsNotFound(err) { logrus.WithError(err).WithField("container", container.ID).Error("Error cleaning up stale containerd container object") } - err = daemon.containerd.Create(ctx, container.ID, spec, shim, createOptions, withImageName(imageRef.String())) + err = daemon.containerd.Create(ctx, container.ID, spec, shim, createOptions) } if err != nil { return translateContainerdStartErr(container.Path, container.SetExitCode, err) @@ -272,10 +264,3 @@ func (daemon *Daemon) Cleanup(container *container.Container) { logrus.Errorf("%s cleanup: failed to delete container from containerd: %v", container.ID, err) } } - -func withImageName(n string) containerd.NewContainerOpts { - return func(ctx context.Context, _ *containerd.Client, c *containers.Container) error { - c.Image = n - return nil - } -}