From 7453d028daaba786b7eaa55ce739e24becd09a33 Mon Sep 17 00:00:00 2001 From: John Howard Date: Mon, 17 Oct 2016 11:48:51 -0700 Subject: [PATCH] Windows: Calculate PID file after root Signed-off-by: John Howard --- cmd/dockerd/docker.go | 7 +++++++ daemon/config_windows.go | 5 +++-- 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/cmd/dockerd/docker.go b/cmd/dockerd/docker.go index 3399597aef..c9d7235bab 100644 --- a/cmd/dockerd/docker.go +++ b/cmd/dockerd/docker.go @@ -3,6 +3,8 @@ package main import ( "fmt" "os" + "path/filepath" + "runtime" "github.com/Sirupsen/logrus" "github.com/docker/docker/cli" @@ -61,6 +63,11 @@ func runDaemon(opts daemonOptions) error { daemonCli := NewDaemonCli() + // On Windows, if there's no explicit pidfile set, set to under the daemon root + if runtime.GOOS == "windows" && opts.daemonConfig.Pidfile == "" { + opts.daemonConfig.Pidfile = filepath.Join(opts.daemonConfig.Root, "docker.pid") + } + // On Windows, this may be launching as a service or with an option to // register the service. stop, err := initService(daemonCli) diff --git a/daemon/config_windows.go b/daemon/config_windows.go index 90c2a1dc0a..1219dbd767 100644 --- a/daemon/config_windows.go +++ b/daemon/config_windows.go @@ -2,14 +2,15 @@ package daemon import ( "os" + "path/filepath" "github.com/docker/docker/api/types" "github.com/spf13/pflag" ) var ( - defaultPidFile = os.Getenv("programdata") + string(os.PathSeparator) + "docker.pid" - defaultGraph = os.Getenv("programdata") + string(os.PathSeparator) + "docker" + defaultPidFile string + defaultGraph = filepath.Join(os.Getenv("programdata"), "docker") ) // bridgeConfig stores all the bridge driver specific