2016-05-23 17:49:50 -04:00
|
|
|
package daemon
|
|
|
|
|
|
|
|
import (
|
|
|
|
"fmt"
|
|
|
|
|
|
|
|
"github.com/docker/docker/container"
|
|
|
|
"github.com/docker/docker/libcontainerd"
|
2016-06-20 14:21:01 -04:00
|
|
|
"github.com/docker/engine-api/types"
|
2016-05-23 17:49:50 -04:00
|
|
|
)
|
|
|
|
|
|
|
|
func (daemon *Daemon) getLibcontainerdCreateOptions(container *container.Container) (*[]libcontainerd.CreateOption, error) {
|
|
|
|
createOptions := []libcontainerd.CreateOption{}
|
|
|
|
|
2016-06-20 14:21:01 -04:00
|
|
|
// Ensure a runtime has been assigned to this container
|
|
|
|
if container.HostConfig.Runtime == "" {
|
|
|
|
container.HostConfig.Runtime = types.DefaultRuntimeName
|
|
|
|
container.ToDisk()
|
|
|
|
}
|
|
|
|
|
2016-05-23 17:49:50 -04:00
|
|
|
rt := daemon.configStore.GetRuntime(container.HostConfig.Runtime)
|
|
|
|
if rt == nil {
|
2016-06-20 14:21:01 -04:00
|
|
|
return nil, fmt.Errorf("no such runtime '%s'", container.HostConfig.Runtime)
|
2016-05-23 17:49:50 -04:00
|
|
|
}
|
|
|
|
createOptions = append(createOptions, libcontainerd.WithRuntime(rt.Path, rt.Args))
|
|
|
|
|
|
|
|
return &createOptions, nil
|
|
|
|
}
|