2014-02-25 11:17:48 -05:00
|
|
|
package main
|
|
|
|
|
|
|
|
import (
|
2014-05-13 14:39:59 -04:00
|
|
|
"fmt"
|
2014-02-25 11:17:48 -05:00
|
|
|
"os"
|
2014-05-13 14:39:59 -04:00
|
|
|
"os/exec"
|
2014-02-25 11:17:48 -05:00
|
|
|
)
|
|
|
|
|
2014-10-08 15:01:25 -04:00
|
|
|
var (
|
|
|
|
// the docker binary to use
|
|
|
|
dockerBinary = "docker"
|
2014-02-25 11:17:48 -05:00
|
|
|
|
2014-10-08 15:01:25 -04:00
|
|
|
// the private registry image to use for tests involving the registry
|
|
|
|
registryImageName = "registry"
|
2014-02-25 11:17:48 -05:00
|
|
|
|
2014-10-08 15:01:25 -04:00
|
|
|
// the private registry to use for tests
|
|
|
|
privateRegistryURL = "127.0.0.1:5000"
|
2014-02-25 11:17:48 -05:00
|
|
|
|
2014-10-20 15:27:26 -04:00
|
|
|
dockerBasePath = "/var/lib/docker"
|
|
|
|
execDriverPath = dockerBasePath + "/execdriver/native"
|
|
|
|
volumesConfigPath = dockerBasePath + "/volumes"
|
|
|
|
volumesStoragePath = dockerBasePath + "/vfs/dir"
|
2014-09-10 12:43:16 -04:00
|
|
|
|
2014-10-08 15:01:25 -04:00
|
|
|
workingDirectory string
|
|
|
|
)
|
2014-02-25 11:17:48 -05:00
|
|
|
|
|
|
|
func init() {
|
|
|
|
if dockerBin := os.Getenv("DOCKER_BINARY"); dockerBin != "" {
|
|
|
|
dockerBinary = dockerBin
|
2014-05-13 14:39:59 -04:00
|
|
|
} 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)
|
|
|
|
}
|
2014-02-25 11:17:48 -05:00
|
|
|
}
|
|
|
|
if registryImage := os.Getenv("REGISTRY_IMAGE"); registryImage != "" {
|
|
|
|
registryImageName = registryImage
|
|
|
|
}
|
|
|
|
if registry := os.Getenv("REGISTRY_URL"); registry != "" {
|
|
|
|
privateRegistryURL = registry
|
|
|
|
}
|
|
|
|
workingDirectory, _ = os.Getwd()
|
|
|
|
}
|