mirror of
https://github.com/moby/moby.git
synced 2022-11-09 12:21:53 -05:00
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:
parent
6f651ec62b
commit
46578a2359
1 changed files with 11 additions and 0 deletions
|
@ -1,7 +1,9 @@
|
||||||
package main
|
package main
|
||||||
|
|
||||||
import (
|
import (
|
||||||
|
"fmt"
|
||||||
"os"
|
"os"
|
||||||
|
"os/exec"
|
||||||
)
|
)
|
||||||
|
|
||||||
// the docker binary to use
|
// the docker binary to use
|
||||||
|
@ -18,6 +20,15 @@ var workingDirectory string
|
||||||
func init() {
|
func init() {
|
||||||
if dockerBin := os.Getenv("DOCKER_BINARY"); dockerBin != "" {
|
if dockerBin := os.Getenv("DOCKER_BINARY"); dockerBin != "" {
|
||||||
dockerBinary = 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 != "" {
|
if registryImage := os.Getenv("REGISTRY_IMAGE"); registryImage != "" {
|
||||||
registryImageName = registryImage
|
registryImageName = registryImage
|
||||||
|
|
Loading…
Reference in a new issue