Signed-off-by: Anda Xu <anda.xu@docker.com>
| ... | ... |
@@ -284,17 +284,7 @@ func newRouterOptions(config *config.Config, d *daemon.Daemon) (routerOptions, e |
| 284 | 284 |
if err != nil {
|
| 285 | 285 |
return opts, err |
| 286 | 286 |
} |
| 287 |
- cgroupParent := "docker" |
|
| 288 |
- useSystemd := daemon.UsingSystemd(config) |
|
| 289 |
- if useSystemd {
|
|
| 290 |
- cgroupParent = "system.slice" |
|
| 291 |
- } |
|
| 292 |
- if config.CgroupParent != "" {
|
|
| 293 |
- cgroupParent = config.CgroupParent |
|
| 294 |
- } |
|
| 295 |
- if useSystemd {
|
|
| 296 |
- cgroupParent = cgroupParent + ":" + "docker" + ":" |
|
| 297 |
- } |
|
| 287 |
+ cgroupParent := newCgroupParent(config) |
|
| 298 | 288 |
bk, err := buildkit.New(buildkit.Opt{
|
| 299 | 289 |
SessionManager: sm, |
| 300 | 290 |
Root: filepath.Join(config.Root, "buildkit"), |
| ... | ... |
@@ -13,6 +13,7 @@ import ( |
| 13 | 13 |
"github.com/containerd/containerd/runtime/v1/linux" |
| 14 | 14 |
"github.com/docker/docker/cmd/dockerd/hack" |
| 15 | 15 |
"github.com/docker/docker/daemon" |
| 16 |
+ "github.com/docker/docker/daemon/config" |
|
| 16 | 17 |
"github.com/docker/docker/libcontainerd/supervisor" |
| 17 | 18 |
"github.com/docker/libnetwork/portallocator" |
| 18 | 19 |
"golang.org/x/sys/unix" |
| ... | ... |
@@ -107,3 +108,18 @@ func wrapListeners(proto string, ls []net.Listener) []net.Listener {
|
| 107 | 107 |
} |
| 108 | 108 |
return ls |
| 109 | 109 |
} |
| 110 |
+ |
|
| 111 |
+func newCgroupParent(config *config.Config) string {
|
|
| 112 |
+ cgroupParent := "docker" |
|
| 113 |
+ useSystemd := daemon.UsingSystemd(config) |
|
| 114 |
+ if useSystemd {
|
|
| 115 |
+ cgroupParent = "system.slice" |
|
| 116 |
+ } |
|
| 117 |
+ if config.CgroupParent != "" {
|
|
| 118 |
+ cgroupParent = config.CgroupParent |
|
| 119 |
+ } |
|
| 120 |
+ if useSystemd {
|
|
| 121 |
+ cgroupParent = cgroupParent + ":" + "docker" + ":" |
|
| 122 |
+ } |
|
| 123 |
+ return cgroupParent |
|
| 124 |
+} |
| ... | ... |
@@ -6,6 +6,7 @@ import ( |
| 6 | 6 |
"os" |
| 7 | 7 |
"path/filepath" |
| 8 | 8 |
|
| 9 |
+ "github.com/docker/docker/daemon/config" |
|
| 9 | 10 |
"github.com/docker/docker/libcontainerd/supervisor" |
| 10 | 11 |
"github.com/sirupsen/logrus" |
| 11 | 12 |
"golang.org/x/sys/windows" |
| ... | ... |
@@ -83,3 +84,7 @@ func allocateDaemonPort(addr string) error {
|
| 83 | 83 |
func wrapListeners(proto string, ls []net.Listener) []net.Listener {
|
| 84 | 84 |
return ls |
| 85 | 85 |
} |
| 86 |
+ |
|
| 87 |
+func newCgroupParent(config *config.Config) string {
|
|
| 88 |
+ return "" |
|
| 89 |
+} |