mirror of
https://github.com/moby/moby.git
synced 2022-11-09 12:21:53 -05:00
Merge pull request #14559 from Microsoft/10662-todo1
Windows: Move daemon check back centrally
This commit is contained in:
commit
b0da494aa3
3 changed files with 9 additions and 18 deletions
|
@ -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
|
||||
}
|
||||
|
|
|
@ -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")
|
||||
}
|
||||
|
|
|
@ -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.
|
||||
|
||||
|
|
Loading…
Reference in a new issue