mirror of https://github.com/docker/docs.git
Check for OS and root privileges in NewDaemon
Docker-DCO-1.1-Signed-off-by: Solomon Hykes <solomon@docker.com> (github: shykes)
This commit is contained in:
parent
bbca4867f8
commit
419b9fe164
|
@ -761,6 +761,12 @@ func NewDaemon(config *daemonconfig.Config, eng *engine.Engine) (*Daemon, error)
|
||||||
}
|
}
|
||||||
|
|
||||||
func NewDaemonFromDirectory(config *daemonconfig.Config, eng *engine.Engine) (*Daemon, error) {
|
func NewDaemonFromDirectory(config *daemonconfig.Config, eng *engine.Engine) (*Daemon, error) {
|
||||||
|
if runtime.GOOS != "linux" {
|
||||||
|
log.Fatalf("The Docker daemon is only supported on linux")
|
||||||
|
}
|
||||||
|
if os.Geteuid() != 0 {
|
||||||
|
log.Fatalf("The Docker daemon needs to be run as root")
|
||||||
|
}
|
||||||
if !config.EnableSelinuxSupport {
|
if !config.EnableSelinuxSupport {
|
||||||
selinuxSetDisabled()
|
selinuxSetDisabled()
|
||||||
}
|
}
|
||||||
|
|
|
@ -114,13 +114,6 @@ func main() {
|
||||||
}
|
}
|
||||||
|
|
||||||
if *flDaemon {
|
if *flDaemon {
|
||||||
if runtime.GOOS != "linux" {
|
|
||||||
log.Fatalf("The Docker daemon is only supported on linux")
|
|
||||||
}
|
|
||||||
if os.Geteuid() != 0 {
|
|
||||||
log.Fatalf("The Docker daemon needs to be run as root")
|
|
||||||
}
|
|
||||||
|
|
||||||
if flag.NArg() != 0 {
|
if flag.NArg() != 0 {
|
||||||
flag.Usage()
|
flag.Usage()
|
||||||
return
|
return
|
||||||
|
|
Loading…
Reference in New Issue