From 76a2ab6e34e6cdd66899815aeeaac2048e5bafce Mon Sep 17 00:00:00 2001 From: Alexander Larsson Date: Tue, 10 Sep 2013 21:04:25 +0200 Subject: [PATCH] Allow specifying the docker client path in _DOCKER_INIT_PATH I currently need this to get the tests running, otherwise it will mount the docker.test binary inside the containers, which doesn't work due to the libdevmapper.so dependency. --- runtime.go | 23 ++++++++++++++--------- 1 file changed, 14 insertions(+), 9 deletions(-) diff --git a/runtime.go b/runtime.go index 60046e29b0..2b776a5e01 100644 --- a/runtime.go +++ b/runtime.go @@ -52,16 +52,21 @@ type Runtime struct { var sysInitPath string func init() { - selfPath := utils.SelfPath() - - // If we have a separate docker-init, use that, otherwise use the - // main docker binary - dir := filepath.Dir(selfPath) - dockerInitPath := filepath.Join(dir, "docker-init") - if _, err := os.Stat(dockerInitPath); err != nil { - sysInitPath = selfPath + env := os.Getenv("_DOCKER_INIT_PATH") + if env != "" { + sysInitPath = env } else { - sysInitPath = dockerInitPath + selfPath := utils.SelfPath() + + // If we have a separate docker-init, use that, otherwise use the + // main docker binary + dir := filepath.Dir(selfPath) + dockerInitPath := filepath.Join(dir, "docker-init") + if _, err := os.Stat(dockerInitPath); err != nil { + sysInitPath = selfPath + } else { + sysInitPath = dockerInitPath + } } }