mirror of
https://github.com/moby/moby.git
synced 2022-11-09 12:21:53 -05:00
934328d8ea
Signed-off-by: Amit Krishnan <krish.amit@gmail.com> Signed-off-by: Alexander Morozov <lk4d4@docker.com>
31 lines
857 B
Go
31 lines
857 B
Go
// +build !windows
|
|
|
|
package daemon
|
|
|
|
import (
|
|
"fmt"
|
|
|
|
"github.com/docker/docker/container"
|
|
"github.com/docker/docker/libcontainerd"
|
|
)
|
|
|
|
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 = stockRuntimeName
|
|
container.ToDisk()
|
|
}
|
|
|
|
rt := daemon.configStore.GetRuntime(container.HostConfig.Runtime)
|
|
if rt == nil {
|
|
return nil, fmt.Errorf("no such runtime '%s'", container.HostConfig.Runtime)
|
|
}
|
|
if UsingSystemd(daemon.configStore) {
|
|
rt.Args = append(rt.Args, "--systemd-cgroup=true")
|
|
}
|
|
createOptions = append(createOptions, libcontainerd.WithRuntime(rt.Path, rt.Args))
|
|
|
|
return createOptions, nil
|
|
}
|