Allow specifying the docker client path in _DOCKER_INIT_PATH

I currently need this to get the tests running, otherwise it will
mount the docker.test binary inside the containers, which doesn't
work due to the libdevmapper.so dependency.
This commit is contained in:
Alexander Larsson 2013-09-10 21:04:25 +02:00 committed by Victor Vieux
parent bc7fa7b957
commit 6938a36c69
1 changed files with 14 additions and 9 deletions

View File

@ -52,16 +52,21 @@ type Runtime struct {
var sysInitPath string var sysInitPath string
func init() { func init() {
selfPath := utils.SelfPath() env := os.Getenv("_DOCKER_INIT_PATH")
if env != "" {
// If we have a separate docker-init, use that, otherwise use the sysInitPath = env
// main docker binary
dir := filepath.Dir(selfPath)
dockerInitPath := filepath.Join(dir, "docker-init")
if _, err := os.Stat(dockerInitPath); err != nil {
sysInitPath = selfPath
} else { } else {
sysInitPath = dockerInitPath selfPath := utils.SelfPath()
// If we have a separate docker-init, use that, otherwise use the
// main docker binary
dir := filepath.Dir(selfPath)
dockerInitPath := filepath.Join(dir, "docker-init")
if _, err := os.Stat(dockerInitPath); err != nil {
sysInitPath = selfPath
} else {
sysInitPath = dockerInitPath
}
} }
} }