Browse Source

check if the daemon is run as root on startup

This commit makes Docker throw an error if the daemon isn't started as
root.

Docker-DCO-1.1-Signed-off-by: Cristian Staretu <cristian.staretu@gmail.com> (github: unclejack)
unclejack 11 years ago
parent
commit
4fac4d2149
1 changed files with 4 additions and 0 deletions
  1. 4 0
      docker/docker.go

+ 4 - 0
docker/docker.go

@@ -97,6 +97,10 @@ func main() {
 	}
 
 	if *flDaemon {
+		if os.Geteuid() != 0 {
+			log.Fatalf("The Docker daemon needs to be run as root")
+		}
+
 		if flag.NArg() != 0 {
 			flag.Usage()
 			return