Merge pull request #23772 from mlaventure/fix-missing-runtime-on-upgrade
Fix missing container runtime on upgrade
This commit is contained in:
commit
f8656a6e37
1 changed files with 8 additions and 1 deletions
|
@ -5,14 +5,21 @@ import (
|
|||
|
||||
"github.com/docker/docker/container"
|
||||
"github.com/docker/docker/libcontainerd"
|
||||
"github.com/docker/engine-api/types"
|
||||
)
|
||||
|
||||
func (daemon *Daemon) getLibcontainerdCreateOptions(container *container.Container) (*[]libcontainerd.CreateOption, error) {
|
||||
createOptions := []libcontainerd.CreateOption{}
|
||||
|
||||
// Ensure a runtime has been assigned to this container
|
||||
if container.HostConfig.Runtime == "" {
|
||||
container.HostConfig.Runtime = types.DefaultRuntimeName
|
||||
container.ToDisk()
|
||||
}
|
||||
|
||||
rt := daemon.configStore.GetRuntime(container.HostConfig.Runtime)
|
||||
if rt == nil {
|
||||
return nil, fmt.Errorf("No such runtime '%s'", container.HostConfig.Runtime)
|
||||
return nil, fmt.Errorf("no such runtime '%s'", container.HostConfig.Runtime)
|
||||
}
|
||||
createOptions = append(createOptions, libcontainerd.WithRuntime(rt.Path, rt.Args))
|
||||
|
||||
|
|
Loading…
Reference in a new issue