create newBuildKit function separately in daemon_unix.go and daemon_windows.go for cross platform build
Signed-off-by: Anda Xu <anda.xu@docker.com>
This commit is contained in:
parent
54b3af4c7d
commit
66ac92cdc6
|
@ -284,17 +284,7 @@ func newRouterOptions(config *config.Config, d *daemon.Daemon) (routerOptions, e
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return opts, err
|
return opts, err
|
||||||
}
|
}
|
||||||
cgroupParent := "docker"
|
cgroupParent := newCgroupParent(config)
|
||||||
useSystemd := daemon.UsingSystemd(config)
|
|
||||||
if useSystemd {
|
|
||||||
cgroupParent = "system.slice"
|
|
||||||
}
|
|
||||||
if config.CgroupParent != "" {
|
|
||||||
cgroupParent = config.CgroupParent
|
|
||||||
}
|
|
||||||
if useSystemd {
|
|
||||||
cgroupParent = cgroupParent + ":" + "docker" + ":"
|
|
||||||
}
|
|
||||||
bk, err := buildkit.New(buildkit.Opt{
|
bk, err := buildkit.New(buildkit.Opt{
|
||||||
SessionManager: sm,
|
SessionManager: sm,
|
||||||
Root: filepath.Join(config.Root, "buildkit"),
|
Root: filepath.Join(config.Root, "buildkit"),
|
||||||
|
|
|
@ -13,6 +13,7 @@ import (
|
||||||
"github.com/containerd/containerd/runtime/v1/linux"
|
"github.com/containerd/containerd/runtime/v1/linux"
|
||||||
"github.com/docker/docker/cmd/dockerd/hack"
|
"github.com/docker/docker/cmd/dockerd/hack"
|
||||||
"github.com/docker/docker/daemon"
|
"github.com/docker/docker/daemon"
|
||||||
|
"github.com/docker/docker/daemon/config"
|
||||||
"github.com/docker/docker/libcontainerd/supervisor"
|
"github.com/docker/docker/libcontainerd/supervisor"
|
||||||
"github.com/docker/libnetwork/portallocator"
|
"github.com/docker/libnetwork/portallocator"
|
||||||
"golang.org/x/sys/unix"
|
"golang.org/x/sys/unix"
|
||||||
|
@ -107,3 +108,18 @@ func wrapListeners(proto string, ls []net.Listener) []net.Listener {
|
||||||
}
|
}
|
||||||
return ls
|
return ls
|
||||||
}
|
}
|
||||||
|
|
||||||
|
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
|
||||||
|
}
|
||||||
|
|
|
@ -6,6 +6,7 @@ import (
|
||||||
"os"
|
"os"
|
||||||
"path/filepath"
|
"path/filepath"
|
||||||
|
|
||||||
|
"github.com/docker/docker/daemon/config"
|
||||||
"github.com/docker/docker/libcontainerd/supervisor"
|
"github.com/docker/docker/libcontainerd/supervisor"
|
||||||
"github.com/sirupsen/logrus"
|
"github.com/sirupsen/logrus"
|
||||||
"golang.org/x/sys/windows"
|
"golang.org/x/sys/windows"
|
||||||
|
@ -83,3 +84,7 @@ func allocateDaemonPort(addr string) error {
|
||||||
func wrapListeners(proto string, ls []net.Listener) []net.Listener {
|
func wrapListeners(proto string, ls []net.Listener) []net.Listener {
|
||||||
return ls
|
return ls
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func newCgroupParent(config *config.Config) string {
|
||||||
|
return ""
|
||||||
|
}
|
||||||
|
|
Loading…
Reference in New Issue