forked from moby/moby
-
Notifications
You must be signed in to change notification settings - Fork 0
/
start_unix.go
31 lines (24 loc) · 857 Bytes
/
start_unix.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
// +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
}