1
0
Fork 0
mirror of https://github.com/moby/moby.git synced 2022-11-09 12:21:53 -05:00
moby--moby/cmd/dockerd/docker_windows.go
Sebastiaan van Stijn cd3e84c6b3
Split daemon service code to _windows file
This moves some of the code that was conditionally
executed on Windows to a separate, windows-only file.

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2018-03-21 12:57:53 +01:00

38 lines
905 B
Go

package main
import (
"path/filepath"
_ "github.com/docker/docker/autogen/winresources/dockerd"
"github.com/sirupsen/logrus"
)
func runDaemon(opts *daemonOptions) error {
daemonCli := NewDaemonCli()
// On Windows, this may be launching as a service or with an option to
// register the service.
stop, runAsService, err := initService(daemonCli)
if err != nil {
logrus.Fatal(err)
}
if stop {
return nil
}
// Windows specific settings as these are not defaulted.
if opts.configFile == "" {
opts.configFile = filepath.Join(opts.daemonConfig.Root, `config\daemon.json`)
}
if runAsService {
// If Windows SCM manages the service - no need for PID files
opts.daemonConfig.Pidfile = ""
} else if opts.daemonConfig.Pidfile == "" {
opts.daemonConfig.Pidfile = filepath.Join(opts.daemonConfig.Root, "docker.pid")
}
err = daemonCli.start(opts)
notifyShutdown(err)
return err
}