diff --git a/daemon/daemon.go b/daemon/daemon.go index 21fea69142..4310b3528c 100644 --- a/daemon/daemon.go +++ b/daemon/daemon.go @@ -43,8 +43,7 @@ var ( validContainerNameChars = `[a-zA-Z0-9][a-zA-Z0-9_.-]` validContainerNamePattern = regexp.MustCompile(`^/?` + validContainerNameChars + `+$`) - // TODO Windows. Change this once daemon is up and running. - ErrSystemNotSupported = errors.New("The Docker daemon is only supported on linux") + ErrSystemNotSupported = errors.New("The Docker daemon is not supported on this platform.") ) type contStore struct { @@ -562,7 +561,12 @@ func NewDaemon(config *Config, registryService *registry.Service) (daemon *Daemo // Do we have a disabled network? config.DisableBridge = isBridgeNetworkDisabled(config) - // Check that the system is supported and we have sufficient privileges + // Verify the platform is supported as a daemon + if runtime.GOOS != "linux" && runtime.GOOS != "windows" { + return nil, ErrSystemNotSupported + } + + // Validate platform-specific requirements if err := checkSystem(); err != nil { return nil, err } diff --git a/daemon/daemon_unix.go b/daemon/daemon_unix.go index b3fe3848cd..f0603acd39 100644 --- a/daemon/daemon_unix.go +++ b/daemon/daemon_unix.go @@ -8,7 +8,6 @@ import ( "net/http" "os" "path/filepath" - "runtime" "strings" "syscall" @@ -197,13 +196,8 @@ func checkConfigOptions(config *Config) error { return nil } -// checkSystem validates the system is supported and we have sufficient privileges +// checkSystem validates platform-specific requirements func checkSystem() error { - // TODO Windows. Once daemon is running on Windows, move this code back to - // NewDaemon() in daemon.go, and extend the check to support Windows. - if runtime.GOOS != "linux" { - return ErrSystemNotSupported - } if os.Geteuid() != 0 { return fmt.Errorf("The Docker daemon needs to be run as root") } diff --git a/daemon/daemon_windows.go b/daemon/daemon_windows.go index 1000beefc0..551c6c015c 100644 --- a/daemon/daemon_windows.go +++ b/daemon/daemon_windows.go @@ -3,7 +3,6 @@ package daemon import ( "fmt" "os" - "runtime" "syscall" "github.com/Sirupsen/logrus" @@ -82,16 +81,10 @@ func checkConfigOptions(config *Config) error { return nil } -// checkSystem validates the system is supported and we have sufficient privileges +// checkSystem validates platform-specific requirements func checkSystem() error { var dwVersion uint32 - // TODO Windows. Once daemon is running on Windows, move this code back to - // NewDaemon() in daemon.go, and extend the check to support Windows. - if runtime.GOOS != "linux" && runtime.GOOS != "windows" { - return ErrSystemNotSupported - } - // TODO Windows. May need at some point to ensure have elevation and // possibly LocalSystem.