mirror of
https://github.com/moby/moby.git
synced 2022-11-09 12:21:53 -05:00
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>
This commit is contained in:
parent
761066faf1
commit
51f5b1279d
1 changed files with 2 additions and 17 deletions
|
@ -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)
|
err = daemon.containerd.Create(ctx, container.ID, spec, shim, createOptions)
|
||||||
if err != nil {
|
|
||||||
return err
|
|
||||||
}
|
|
||||||
|
|
||||||
err = daemon.containerd.Create(ctx, container.ID, spec, shim, createOptions, withImageName(imageRef.String()))
|
|
||||||
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
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
Loading…
Reference in a new issue