Merge pull request #41210 from AkihiroSuda/shim2-default

cgroup v1: change the default runtime to io.containerd.runc.v2
This commit is contained in:
Brian Goff 2020-07-15 12:54:44 -07:00 committed by GitHub
commit 60c45c332f
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 2 additions and 10 deletions

View file

@ -15,7 +15,6 @@ import (
"github.com/docker/docker/api/types"
"github.com/docker/docker/daemon/config"
"github.com/docker/docker/pkg/ioutils"
"github.com/opencontainers/runc/libcontainer/cgroups"
"github.com/pkg/errors"
"github.com/sirupsen/logrus"
)
@ -34,16 +33,9 @@ func configureRuntimes(conf *config.Config) {
if conf.Runtimes == nil {
conf.Runtimes = make(map[string]types.Runtime)
}
conf.Runtimes[config.StockRuntimeName] = types.Runtime{Path: defaultRuntimeName, Shim: getShimConfig(conf, defaultRuntimeName)}
conf.Runtimes[config.LinuxV1RuntimeName] = types.Runtime{Path: defaultRuntimeName, Shim: defaultV1ShimConfig(conf, defaultRuntimeName)}
conf.Runtimes[config.LinuxV2RuntimeName] = types.Runtime{Path: defaultRuntimeName, Shim: defaultV2ShimConfig(conf, defaultRuntimeName)}
}
func getShimConfig(conf *config.Config, runtimePath string) *types.ShimConfig {
if cgroups.IsCgroup2UnifiedMode() {
return defaultV2ShimConfig(conf, runtimePath)
}
return defaultV1ShimConfig(conf, runtimePath)
conf.Runtimes[config.StockRuntimeName] = conf.Runtimes[config.LinuxV2RuntimeName]
}
func defaultV2ShimConfig(conf *config.Config, runtimePath string) *types.ShimConfig {

View file

@ -24,7 +24,7 @@ func (daemon *Daemon) getLibcontainerdCreateOptions(container *container.Contain
if err != nil {
return "", nil, translateContainerdStartErr(container.Path, container.SetExitCode, err)
}
rt.Shim = getShimConfig(daemon.configStore, p)
rt.Shim = defaultV2ShimConfig(daemon.configStore, p)
}
if rt.Shim.Binary == linuxShimV1 {
if cgroups.IsCgroup2UnifiedMode() {