From 1f9d74e1bba7b59e0ecc5736ce03d6aea84025ef Mon Sep 17 00:00:00 2001 From: Andrei Vagin Date: Tue, 23 Nov 2021 13:55:59 -0800 Subject: [PATCH] Set native.cgroupdriver=cgroupfs for docker --- .buildkite/hooks/pre-command | 5 +++-- runsc/cmd/install.go | 13 +++++++++++++ 2 files changed, 16 insertions(+), 2 deletions(-) diff --git a/.buildkite/hooks/pre-command b/.buildkite/hooks/pre-command index 68bf14ef9..600e1fb1c 100644 --- a/.buildkite/hooks/pre-command +++ b/.buildkite/hooks/pre-command @@ -9,7 +9,8 @@ function install_pkgs() { done } install_pkgs make linux-libc-dev graphviz jq curl binutils gnupg gnupg-agent \ - gcc pkg-config apt-transport-https ca-certificates software-properties-common + gcc pkg-config apt-transport-https ca-certificates software-properties-common \ + jq # Install headers, only if available. if test -n "$(apt-cache search --names-only "^linux-headers-$(uname -r)$")"; then @@ -24,7 +25,7 @@ export TOTAL_PARTITIONS=${BUILDKITE_PARALLEL_JOB_COUNT:-1} # Ensure Docker has experimental enabled. EXPERIMENTAL=$(sudo docker version --format='{{.Server.Experimental}}') if test "${EXPERIMENTAL}" != "true"; then - make sudo TARGETS=//runsc:runsc ARGS="install --experimental=true" + make sudo TARGETS=//runsc:runsc ARGS="install --experimental=true --cgroupdriver=cgroupfs" sudo systemctl restart docker fi diff --git a/runsc/cmd/install.go b/runsc/cmd/install.go index dc9e01d95..43f8bd7d7 100644 --- a/runsc/cmd/install.go +++ b/runsc/cmd/install.go @@ -32,6 +32,7 @@ type Install struct { ConfigFile string Runtime string Experimental bool + CgroupDriver string } // Name implements subcommands.Command.Name. @@ -55,6 +56,7 @@ func (i *Install) SetFlags(fs *flag.FlagSet) { fs.StringVar(&i.ConfigFile, "config_file", "/etc/docker/daemon.json", "path to Docker daemon config file") fs.StringVar(&i.Runtime, "runtime", "runsc", "runtime name") fs.BoolVar(&i.Experimental, "experimental", false, "enable experimental features") + fs.StringVar(&i.CgroupDriver, "cgroupdriver", "", "docker cgroup driver") } // Execute implements subcommands.Command.Execute. @@ -95,6 +97,17 @@ func (i *Install) Execute(_ context.Context, f *flag.FlagSet, _ ...interface{}) c["experimental"] = true } + if i.CgroupDriver != "" { + v, ok := c["exec-opts"] + if ok { + log.Printf("%v", v) + opts := v.([]interface{}) + c["exec-opts"] = append(opts, fmt.Sprintf("native.cgroupdriver=%s", i.CgroupDriver)) + } else { + c["exec-opts"] = []string{fmt.Sprintf("native.cgroupdriver=%s", i.CgroupDriver)} + } + } + // Write out the runtime. if err := writeConfig(c, i.ConfigFile); err != nil { log.Fatalf("Error writing config file %q: %v", i.ConfigFile, err)