Set native.cgroupdriver=cgroupfs for docker

This commit is contained in:
Andrei Vagin
2021-11-26 10:14:09 +00:00
committed by Daniel Dao
parent 11700f409f
commit 1f9d74e1bb
2 changed files with 16 additions and 2 deletions
+3 -2
View File
@@ -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
+13
View File
@@ -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)