From 4fac4d2149856f0740a98e87ef0e0e6bd04d1b53 Mon Sep 17 00:00:00 2001 From: unclejack Date: Wed, 30 Apr 2014 14:13:39 +0300 Subject: [PATCH] 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 (github: unclejack) --- docker/docker.go | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/docker/docker.go b/docker/docker.go index 4d90ab8b2e..f0001b8f3d 100644 --- a/docker/docker.go +++ b/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