Blame SOURCES/docker-cert-path.patch

b215bf
From 2bc25525096c60d32c49c506477e3585e8613182 Mon Sep 17 00:00:00 2001
b215bf
From: Jessica Frazelle <jess@docker.com>
b215bf
Date: Tue, 9 Dec 2014 14:18:25 -0800
b215bf
Subject: [PATCH] Change cert path to /etc/docker for root user
b215bf
b215bf
Docker-DCO-1.1-Signed-off-by: Jessica Frazelle <jess@docker.com> (github: jfrazelle)
b215bf
---
b215bf
 docker/flags.go | 7 ++++++-
b215bf
 1 file changed, 6 insertions(+), 1 deletion(-)
b215bf
b215bf
diff --git a/docker/flags.go b/docker/flags.go
b215bf
index 6601b4f..0866519 100644
b215bf
--- a/docker/flags.go
b215bf
+++ b/docker/flags.go
b215bf
@@ -3,6 +3,7 @@ package main
b215bf
 import (
b215bf
 	"fmt"
b215bf
 	"os"
b215bf
+	"os/user"
b215bf
 	"path/filepath"
b215bf
 	"runtime"
b215bf
 
b215bf
@@ -17,7 +18,11 @@ var (
b215bf
 
b215bf
 func init() {
b215bf
 	if dockerCertPath == "" {
b215bf
-		dockerCertPath = filepath.Join(getHomeDir(), ".docker")
b215bf
+		if currentUser, err := user.Current(); err != nil || currentUser.Uid == "0" {
b215bf
+			dockerCertPath = "/etc/docker"
b215bf
+		} else {
b215bf
+			dockerCertPath = filepath.Join(getHomeDir(), ".docker")
b215bf
+		}
b215bf
 	}
b215bf
 }
b215bf