From 9195f7ed61fe056e65a541a29fe935350f2b6308 Mon Sep 17 00:00:00 2001 From: unclejack Date: Tue, 13 May 2014 21:39:59 +0300 Subject: [PATCH] integcli: resolve full path to docker binary Setting dockerBinary to the full path of the Docker binary is a good idea and this is now done in the test code. Docker-DCO-1.1-Signed-off-by: Cristian Staretu (github: unclejack) Upstream-commit: 46578a2359714e32d61af4efaeea86b7ff770359 Component: engine --- components/engine/integration-cli/docker_test_vars.go | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/components/engine/integration-cli/docker_test_vars.go b/components/engine/integration-cli/docker_test_vars.go index f8bd5c116b..78e0685a9d 100644 --- a/components/engine/integration-cli/docker_test_vars.go +++ b/components/engine/integration-cli/docker_test_vars.go @@ -1,7 +1,9 @@ package main import ( + "fmt" "os" + "os/exec" ) // the docker binary to use @@ -18,6 +20,15 @@ var workingDirectory string func init() { if dockerBin := os.Getenv("DOCKER_BINARY"); dockerBin != "" { dockerBinary = dockerBin + } else { + whichCmd := exec.Command("which", "docker") + out, _, err := runCommandWithOutput(whichCmd) + if err == nil { + dockerBinary = stripTrailingCharacters(out) + } else { + fmt.Printf("ERROR: couldn't resolve full path to the Docker binary") + os.Exit(1) + } } if registryImage := os.Getenv("REGISTRY_IMAGE"); registryImage != "" { registryImageName = registryImage