From 354229732bae76233eeee630000c179ac96f0e95 Mon Sep 17 00:00:00 2001 From: Harshavardhana Date: Thu, 18 Feb 2016 11:10:53 -0800 Subject: [PATCH] docker: Make sure that we properly check for containers. --- Makefile | 2 +- runtime-checks.go | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/Makefile b/Makefile index 2c89b430a..35bf4a177 100644 --- a/Makefile +++ b/Makefile @@ -138,7 +138,7 @@ install: gomake-all dockerimage: checkdocker verifiers $(UI_ASSETS) @echo "Building docker image:" minio:$(TAG) - @GO15VENDOREXPERIMENT=1 go build --ldflags $(DOCKER_LDFLAGS) -o minio.dockerimage + @GO15VENDOREXPERIMENT=1 GOOS=linux GOARCH=amd64 go build --ldflags $(DOCKER_LDFLAGS) -o minio.dockerimage @mkdir -p export @sudo docker build --rm --tag=minio/minio:$(TAG) . @rmdir export diff --git a/runtime-checks.go b/runtime-checks.go index 89940ab7d..0a95bd76f 100644 --- a/runtime-checks.go +++ b/runtime-checks.go @@ -29,12 +29,12 @@ import ( // isContainerized returns true if we are inside a containerized environment. func isContainerized() bool { // Docker containers contain ".dockerinit" at its root path. - if _, e := os.Stat("/.dockerinit"); os.IsNotExist(e) { + if _, e := os.Stat("/.dockerinit"); e == nil { return true } // Check if cgroup policies for init process contains docker string. - if cgroupData, e := ioutil.ReadFile("/proc/1/cgroup"); e != nil { + if cgroupData, e := ioutil.ReadFile("/proc/1/cgroup"); e == nil { if strings.Contains(string(cgroupData), "/docker-") { return true }