2015-05-16 02:34:26 +03:00
|
|
|
package main
|
|
|
|
|
|
|
|
import (
|
2015-12-11 02:35:10 +03:00
|
|
|
"fmt"
|
2016-04-12 18:21:20 +03:00
|
|
|
"net"
|
2015-07-30 22:39:19 +03:00
|
|
|
"os"
|
2015-12-11 02:35:10 +03:00
|
|
|
"syscall"
|
2015-07-30 22:39:19 +03:00
|
|
|
|
2015-12-11 02:35:10 +03:00
|
|
|
"github.com/Sirupsen/logrus"
|
2016-03-18 21:53:27 +03:00
|
|
|
"github.com/docker/docker/libcontainerd"
|
2015-12-11 02:35:10 +03:00
|
|
|
"github.com/docker/docker/pkg/system"
|
2015-05-16 02:34:26 +03:00
|
|
|
)
|
|
|
|
|
2015-12-11 02:35:10 +03:00
|
|
|
var defaultDaemonConfigFile = os.Getenv("programdata") + string(os.PathSeparator) + "docker" + string(os.PathSeparator) + "config" + string(os.PathSeparator) + "daemon.json"
|
|
|
|
|
2015-05-16 02:34:26 +03:00
|
|
|
// currentUserIsOwner checks whether the current user is the owner of the given
|
|
|
|
// file.
|
|
|
|
func currentUserIsOwner(f string) bool {
|
|
|
|
return false
|
|
|
|
}
|
2015-06-15 16:36:19 +03:00
|
|
|
|
|
|
|
// setDefaultUmask doesn't do anything on windows
|
|
|
|
func setDefaultUmask() error {
|
|
|
|
return nil
|
|
|
|
}
|
2015-07-30 22:39:19 +03:00
|
|
|
|
|
|
|
func getDaemonConfDir() string {
|
|
|
|
return os.Getenv("PROGRAMDATA") + `\docker\config`
|
|
|
|
}
|
2015-09-24 02:42:08 +03:00
|
|
|
|
|
|
|
// notifySystem sends a message to the host when the server is ready to be used
|
|
|
|
func notifySystem() {
|
2016-04-23 03:16:14 +03:00
|
|
|
if service != nil {
|
|
|
|
err := service.started()
|
|
|
|
if err != nil {
|
|
|
|
logrus.Fatal(err)
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
// notifyShutdown is called after the daemon shuts down but before the process exits.
|
|
|
|
func notifyShutdown(err error) {
|
|
|
|
if service != nil {
|
|
|
|
service.stopped(err)
|
|
|
|
}
|
2015-09-24 02:42:08 +03:00
|
|
|
}
|
2015-12-11 02:35:10 +03:00
|
|
|
|
|
|
|
// setupConfigReloadTrap configures a Win32 event to reload the configuration.
|
2016-04-23 03:16:14 +03:00
|
|
|
func (cli *DaemonCli) setupConfigReloadTrap() {
|
2015-12-11 02:35:10 +03:00
|
|
|
go func() {
|
|
|
|
sa := syscall.SecurityAttributes{
|
|
|
|
Length: 0,
|
|
|
|
}
|
|
|
|
ev := "Global\\docker-daemon-config-" + fmt.Sprint(os.Getpid())
|
|
|
|
if h, _ := system.CreateEvent(&sa, false, false, ev); h != 0 {
|
|
|
|
logrus.Debugf("Config reload - waiting signal at %s", ev)
|
|
|
|
for {
|
|
|
|
syscall.WaitForSingleObject(h, syscall.INFINITE)
|
2016-04-23 03:16:14 +03:00
|
|
|
cli.reloadConfig()
|
2015-12-11 02:35:10 +03:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}()
|
|
|
|
}
|
2016-03-18 21:53:27 +03:00
|
|
|
|
|
|
|
func (cli *DaemonCli) getPlatformRemoteOptions() []libcontainerd.RemoteOption {
|
|
|
|
return nil
|
|
|
|
}
|
2016-03-24 21:42:03 +03:00
|
|
|
|
|
|
|
// getLibcontainerdRoot gets the root directory for libcontainerd to store its
|
|
|
|
// state. The Windows libcontainerd implementation does not need to write a spec
|
|
|
|
// or state to disk, so this is a no-op.
|
|
|
|
func (cli *DaemonCli) getLibcontainerdRoot() string {
|
|
|
|
return ""
|
|
|
|
}
|
2016-04-09 09:49:33 +03:00
|
|
|
|
|
|
|
func allocateDaemonPort(addr string) error {
|
|
|
|
return nil
|
|
|
|
}
|
2016-04-12 18:21:20 +03:00
|
|
|
|
|
|
|
func wrapListeners(proto string, ls []net.Listener) []net.Listener {
|
|
|
|
return ls
|
|
|
|
}
|