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)
This commit is contained in:
unclejack 2014-05-13 21:39:59 +03:00
parent 6f651ec62b
commit 46578a2359
1 changed files with 11 additions and 0 deletions

View File

@ -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