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 <cristian.staretu@gmail.com> (github: unclejack)
Upstream-commit: 46578a2359714e32d61af4efaeea86b7ff770359
Component: engine
This commit is contained in:
unclejack
2014-05-17 02:38:28 +03:00
parent 4d36898842
commit 9195f7ed61
@@ -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