|
@@ -19,7 +19,7 @@ import (
|
|
)
|
|
)
|
|
|
|
|
|
// ContainerStart starts a container.
|
|
// ContainerStart starts a container.
|
|
-func (daemon *Daemon) ContainerStart(name string, hostConfig *containertypes.HostConfig, validateHostname bool, checkpoint string) error {
|
|
|
|
|
|
+func (daemon *Daemon) ContainerStart(name string, hostConfig *containertypes.HostConfig, validateHostname bool, checkpoint string, checkpointDir string) error {
|
|
if checkpoint != "" && !daemon.HasExperimental() {
|
|
if checkpoint != "" && !daemon.HasExperimental() {
|
|
return errors.NewBadRequestError(fmt.Errorf("checkpoint is only supported in experimental mode"))
|
|
return errors.NewBadRequestError(fmt.Errorf("checkpoint is only supported in experimental mode"))
|
|
}
|
|
}
|
|
@@ -82,19 +82,19 @@ func (daemon *Daemon) ContainerStart(name string, hostConfig *containertypes.Hos
|
|
return err
|
|
return err
|
|
}
|
|
}
|
|
|
|
|
|
- return daemon.containerStart(container, checkpoint, true)
|
|
|
|
|
|
+ return daemon.containerStart(container, checkpoint, checkpointDir, true)
|
|
}
|
|
}
|
|
|
|
|
|
// Start starts a container
|
|
// Start starts a container
|
|
func (daemon *Daemon) Start(container *container.Container) error {
|
|
func (daemon *Daemon) Start(container *container.Container) error {
|
|
- return daemon.containerStart(container, "", true)
|
|
|
|
|
|
+ return daemon.containerStart(container, "", "", true)
|
|
}
|
|
}
|
|
|
|
|
|
// containerStart prepares the container to run by setting up everything the
|
|
// containerStart prepares the container to run by setting up everything the
|
|
// container needs, such as storage and networking, as well as links
|
|
// container needs, such as storage and networking, as well as links
|
|
// between containers. The container is left waiting for a signal to
|
|
// between containers. The container is left waiting for a signal to
|
|
// begin running.
|
|
// begin running.
|
|
-func (daemon *Daemon) containerStart(container *container.Container, checkpoint string, resetRestartManager bool) (err error) {
|
|
|
|
|
|
+func (daemon *Daemon) containerStart(container *container.Container, checkpoint string, checkpointDir string, resetRestartManager bool) (err error) {
|
|
start := time.Now()
|
|
start := time.Now()
|
|
container.Lock()
|
|
container.Lock()
|
|
defer container.Unlock()
|
|
defer container.Unlock()
|
|
@@ -155,7 +155,11 @@ func (daemon *Daemon) containerStart(container *container.Container, checkpoint
|
|
container.ResetRestartManager(true)
|
|
container.ResetRestartManager(true)
|
|
}
|
|
}
|
|
|
|
|
|
- if err := daemon.containerd.Create(container.ID, checkpoint, container.CheckpointDir(), *spec, container.InitializeStdio, createOptions...); err != nil {
|
|
|
|
|
|
+ if checkpointDir == "" {
|
|
|
|
+ checkpointDir = container.CheckpointDir()
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ if err := daemon.containerd.Create(container.ID, checkpoint, checkpointDir, *spec, container.InitializeStdio, createOptions...); err != nil {
|
|
errDesc := grpc.ErrorDesc(err)
|
|
errDesc := grpc.ErrorDesc(err)
|
|
logrus.Errorf("Create container failed with error: %s", errDesc)
|
|
logrus.Errorf("Create container failed with error: %s", errDesc)
|
|
// if we receive an internal error from the initial start of a container then lets
|
|
// if we receive an internal error from the initial start of a container then lets
|