1
0
Fork 0
mirror of https://github.com/moby/moby.git synced 2022-11-09 12:21:53 -05:00

Windows: Move daemon check back centrally

Signed-off-by: John Howard <jhoward@microsoft.com>
This commit is contained in:
John Howard 2015-07-11 12:32:08 -07:00
parent 9264d38424
commit 62a75fca68
3 changed files with 9 additions and 18 deletions

View file

@ -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
}

View file

@ -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")
}

View file

@ -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.