From cf80bd3fa87d0aff03bf6f9548b021b716b96870 Mon Sep 17 00:00:00 2001 From: Antonio Murdaca Date: Fri, 26 Aug 2016 15:33:26 +0200 Subject: [PATCH] daemon: ensure systemd cgroup is passed down to runtimes Signed-off-by: Antonio Murdaca Upstream-commit: 7f88fca48ed34370238ee1b16a262be3ecea8cbe Component: engine --- components/engine/daemon/daemon_unix.go | 6 +----- components/engine/daemon/start_linux.go | 3 +++ 2 files changed, 4 insertions(+), 5 deletions(-) diff --git a/components/engine/daemon/daemon_unix.go b/components/engine/daemon/daemon_unix.go index 7e5b313e55..1431aabe0c 100644 --- a/components/engine/daemon/daemon_unix.go +++ b/components/engine/daemon/daemon_unix.go @@ -566,11 +566,7 @@ func verifyDaemonSettings(config *Config) error { if config.Runtimes == nil { config.Runtimes = make(map[string]types.Runtime) } - stockRuntimeOpts := []string{} - if UsingSystemd(config) { - stockRuntimeOpts = append(stockRuntimeOpts, "--systemd-cgroup=true") - } - config.Runtimes[stockRuntimeName] = types.Runtime{Path: DefaultRuntimeBinary, Args: stockRuntimeOpts} + config.Runtimes[stockRuntimeName] = types.Runtime{Path: DefaultRuntimeBinary} return nil } diff --git a/components/engine/daemon/start_linux.go b/components/engine/daemon/start_linux.go index c6ad22af85..c509f178c8 100644 --- a/components/engine/daemon/start_linux.go +++ b/components/engine/daemon/start_linux.go @@ -20,6 +20,9 @@ func (daemon *Daemon) getLibcontainerdCreateOptions(container *container.Contain 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