Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

(v2) cmd: dockerd: make systemd specific cgroups tweaks build-time optional #42431

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 15 additions & 0 deletions cmd/dockerd/daemon_nosystemd_unix.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
//go:build no_systemd

package main

import (
"github.com/docker/docker/daemon/config"
)

func newCgroupParent(config *config.Config) string {
if config.CgroupParent == "" {
return "docker"
} else {
return config.CgroupParent
}
}
23 changes: 23 additions & 0 deletions cmd/dockerd/daemon_systemd_unix.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
//go:build linux && !no_systemd

package main

import (
"github.com/docker/docker/daemon"
"github.com/docker/docker/daemon/config"
)

func newCgroupParent(config *config.Config) string {
cgroupParent := "docker"
useSystemd := daemon.UsingSystemd(config)
if useSystemd {
cgroupParent = "system.slice"
}
if config.CgroupParent != "" {
cgroupParent = config.CgroupParent
}
if useSystemd {
cgroupParent = cgroupParent + ":" + "docker" + ":"
}
return cgroupParent
}
17 changes: 0 additions & 17 deletions cmd/dockerd/daemon_unix.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,6 @@ import (
"time"

"github.com/containerd/containerd/log"
"github.com/docker/docker/daemon"
"github.com/docker/docker/daemon/config"
"github.com/docker/docker/libcontainerd/supervisor"
"github.com/docker/docker/libnetwork/portallocator"
"github.com/docker/docker/pkg/homedir"
Expand Down Expand Up @@ -101,21 +99,6 @@ func allocateDaemonPort(addr string) error {
return nil
}

func newCgroupParent(config *config.Config) string {
cgroupParent := "docker"
useSystemd := daemon.UsingSystemd(config)
if useSystemd {
cgroupParent = "system.slice"
}
if config.CgroupParent != "" {
cgroupParent = config.CgroupParent
}
if useSystemd {
cgroupParent = cgroupParent + ":" + "docker" + ":"
}
return cgroupParent
}

func (cli *DaemonCli) initContainerd(ctx context.Context) (func(time.Duration) error, error) {
if cli.ContainerdAddr != "" {
// use system containerd at the given address.
Expand Down
Loading