浏览代码

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 <cpuguy83@gmail.com>
Brian Goff 4 年之前
父节点
当前提交
51f5b1279d
共有 1 个文件被更改,包括 2 次插入17 次删除
  1. 2 17
      daemon/start.go

+ 2 - 17
daemon/start.go

@@ -5,9 +5,6 @@ import (
 	"runtime"
 	"runtime"
 	"time"
 	"time"
 
 
-	"github.com/containerd/containerd"
-	"github.com/containerd/containerd/containers"
-	"github.com/docker/distribution/reference"
 	"github.com/docker/docker/api/types"
 	"github.com/docker/docker/api/types"
 	containertypes "github.com/docker/docker/api/types/container"
 	containertypes "github.com/docker/docker/api/types/container"
 	"github.com/docker/docker/container"
 	"github.com/docker/docker/container"
@@ -181,12 +178,7 @@ func (daemon *Daemon) containerStart(container *container.Container, checkpoint
 
 
 	ctx := context.TODO()
 	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 err != nil {
 		if errdefs.IsConflict(err) {
 		if errdefs.IsConflict(err) {
 			logrus.WithError(err).WithField("container", container.ID).Error("Container not cleaned up from containerd from previous run")
 			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) {
 			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")
 				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 {
 		if err != nil {
 			return translateContainerdStartErr(container.Path, container.SetExitCode, err)
 			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)
 		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
-	}
-}