From af907a35a9fc51497772529053e3174fa38bbb86 Mon Sep 17 00:00:00 2001 From: matt robinson Date: Mon, 18 Apr 2016 19:30:11 -0400 Subject: [PATCH] add environment var to explicitly indicate containerized and allow running as root (#1327) --- docker/Dockerfile | 1 + runtime-checks.go | 5 +++++ 2 files changed, 6 insertions(+) diff --git a/docker/Dockerfile b/docker/Dockerfile index ea97892f1..da892c1e2 100644 --- a/docker/Dockerfile +++ b/docker/Dockerfile @@ -5,4 +5,5 @@ ADD minio.dockerimage /minio ADD export /export EXPOSE 9000 COPY start.sh /start.sh +ENV ALLOW_CONTAINER_ROOT=1 ENTRYPOINT ["/start.sh"] diff --git a/runtime-checks.go b/runtime-checks.go index c9fd35419..402257845 100644 --- a/runtime-checks.go +++ b/runtime-checks.go @@ -41,6 +41,11 @@ func isContainerized() bool { } } + // Check if env var explicitly set + if allow := os.Getenv("ALLOW_CONTAINER_ROOT"); allow == "1" || strings.ToLower(allow) == "true" { + return true + } + /* Add checks for non-docker containers here. */ return false }