2015-05-15 19:34:26 -04:00
|
|
|
package main
|
|
|
|
|
|
|
|
import (
|
2015-12-10 18:35:10 -05:00
|
|
|
"fmt"
|
2016-04-12 11:21:20 -04:00
|
|
|
"net"
|
2015-07-30 15:39:19 -04:00
|
|
|
"os"
|
2016-11-04 15:42:21 -04:00
|
|
|
"path/filepath"
|
2015-07-30 15:39:19 -04:00
|
|
|
|
2018-09-07 16:43:21 -04:00
|
|
|
"github.com/docker/docker/daemon/config"
|
2018-05-23 15:15:21 -04:00
|
|
|
"github.com/docker/docker/libcontainerd/supervisor"
|
2017-07-26 17:42:13 -04:00
|
|
|
"github.com/sirupsen/logrus"
|
2017-05-23 10:22:32 -04:00
|
|
|
"golang.org/x/sys/windows"
|
2015-05-15 19:34:26 -04:00
|
|
|
)
|
|
|
|
|
2016-11-04 15:42:21 -04:00
|
|
|
var defaultDaemonConfigFile = ""
|
2015-12-10 18:35:10 -05:00
|
|
|
|
2015-06-15 09:36:19 -04:00
|
|
|
// setDefaultUmask doesn't do anything on windows
|
|
|
|
func setDefaultUmask() error {
|
|
|
|
return nil
|
|
|
|
}
|
2015-07-30 15:39:19 -04:00
|
|
|
|
2016-11-04 15:42:21 -04:00
|
|
|
func getDaemonConfDir(root string) string {
|
|
|
|
return filepath.Join(root, `\config`)
|
2015-07-30 15:39:19 -04:00
|
|
|
}
|
2015-09-23 19:42:08 -04:00
|
|
|
|
2017-02-01 13:52:16 -05:00
|
|
|
// preNotifySystem sends a message to the host when the API is active, but before the daemon is
|
|
|
|
func preNotifySystem() {
|
|
|
|
// start the service now to prevent timeouts waiting for daemon to start
|
|
|
|
// but still (eventually) complete all requests that are sent after this
|
2016-04-22 20:16:14 -04:00
|
|
|
if service != nil {
|
|
|
|
err := service.started()
|
|
|
|
if err != nil {
|
|
|
|
logrus.Fatal(err)
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2017-02-01 13:52:16 -05:00
|
|
|
// notifySystem sends a message to the host when the server is ready to be used
|
|
|
|
func notifySystem() {
|
|
|
|
}
|
|
|
|
|
2016-04-22 20:16:14 -04:00
|
|
|
// notifyShutdown is called after the daemon shuts down but before the process exits.
|
|
|
|
func notifyShutdown(err error) {
|
|
|
|
if service != nil {
|
2016-09-19 16:36:33 -04:00
|
|
|
if err != nil {
|
|
|
|
logrus.Fatal(err)
|
|
|
|
}
|
2016-04-22 20:16:14 -04:00
|
|
|
service.stopped(err)
|
|
|
|
}
|
2015-09-23 19:42:08 -04:00
|
|
|
}
|
2015-12-10 18:35:10 -05:00
|
|
|
|
2018-05-23 15:15:21 -04:00
|
|
|
func (cli *DaemonCli) getPlatformContainerdDaemonOpts() ([]supervisor.DaemonOpt, error) {
|
2017-09-22 09:52:41 -04:00
|
|
|
return nil, nil
|
|
|
|
}
|
|
|
|
|
2015-12-10 18:35:10 -05:00
|
|
|
// setupConfigReloadTrap configures a Win32 event to reload the configuration.
|
2016-04-22 20:16:14 -04:00
|
|
|
func (cli *DaemonCli) setupConfigReloadTrap() {
|
2015-12-10 18:35:10 -05:00
|
|
|
go func() {
|
2017-05-23 10:22:32 -04:00
|
|
|
sa := windows.SecurityAttributes{
|
2015-12-10 18:35:10 -05:00
|
|
|
Length: 0,
|
|
|
|
}
|
2017-10-19 14:09:29 -04:00
|
|
|
event := "Global\\docker-daemon-config-" + fmt.Sprint(os.Getpid())
|
|
|
|
ev, _ := windows.UTF16PtrFromString(event)
|
2017-08-21 06:58:09 -04:00
|
|
|
if h, _ := windows.CreateEvent(&sa, 0, 0, ev); h != 0 {
|
2017-10-19 14:09:29 -04:00
|
|
|
logrus.Debugf("Config reload - waiting signal at %s", event)
|
2015-12-10 18:35:10 -05:00
|
|
|
for {
|
2017-05-23 10:22:32 -04:00
|
|
|
windows.WaitForSingleObject(h, windows.INFINITE)
|
2016-04-22 20:16:14 -04:00
|
|
|
cli.reloadConfig()
|
2015-12-10 18:35:10 -05:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}()
|
|
|
|
}
|
2016-03-18 14:53:27 -04:00
|
|
|
|
2016-08-19 16:06:28 -04:00
|
|
|
// getSwarmRunRoot gets the root directory for swarm to store runtime state
|
|
|
|
// For example, the control socket
|
|
|
|
func (cli *DaemonCli) getSwarmRunRoot() string {
|
|
|
|
return ""
|
|
|
|
}
|
|
|
|
|
2016-04-09 02:49:33 -04:00
|
|
|
func allocateDaemonPort(addr string) error {
|
|
|
|
return nil
|
|
|
|
}
|
2016-04-12 11:21:20 -04:00
|
|
|
|
|
|
|
func wrapListeners(proto string, ls []net.Listener) []net.Listener {
|
|
|
|
return ls
|
|
|
|
}
|
2018-09-07 16:43:21 -04:00
|
|
|
|
|
|
|
func newCgroupParent(config *config.Config) string {
|
|
|
|
return ""
|
|
|
|
}
|