|
@@ -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
|
|
|
|
- }
|
|
|
|
-}
|
|
|