Skip to content
This repository has been archived by the owner on Oct 11, 2023. It is now read-only.

Commit

Permalink
Merge pull request #2022 from SvenDowideit/v1.0.x-fix-dockerd-bin-det…
Browse files Browse the repository at this point in the history
…ection

Merge pull request #1996 from SvenDowideit/fix-dockerd-bin-detection
  • Loading branch information
SvenDowideit committed Jul 31, 2017
2 parents 1ed76e6 + 20504cf commit 723f69e
Showing 1 changed file with 18 additions and 6 deletions.
24 changes: 18 additions & 6 deletions cmd/control/docker_init.go
Expand Up @@ -29,21 +29,33 @@ func dockerInitAction(c *cli.Context) error {
time.Sleep(200 * time.Millisecond)
}

dockerBin := "/usr/bin/docker"
for _, binPath := range []string{
dockerBin := ""
dockerPaths := []string{
"/usr/bin",
"/opt/bin",
"/usr/local/bin",
"/var/lib/rancher/docker",
} {
}
for _, binPath := range dockerPaths {
if util.ExistsAndExecutable(path.Join(binPath, "dockerd")) {
dockerBin = path.Join(binPath, "dockerd")
break
}
if util.ExistsAndExecutable(path.Join(binPath, "docker")) {
dockerBin = path.Join(binPath, "docker")
break
}
if dockerBin == "" {
for _, binPath := range dockerPaths {
if util.ExistsAndExecutable(path.Join(binPath, "docker")) {
dockerBin = path.Join(binPath, "docker")
break
}
}
}
if dockerBin == "" {
err := fmt.Errorf("Failed to find either dockerd or docker binaries")
log.Error(err)
return err
}
log.Infof("Found %s", dockerBin)

if err := syscall.Mount("", "/", "", syscall.MS_SHARED|syscall.MS_REC, ""); err != nil {
log.Error(err)
Expand Down

0 comments on commit 723f69e

Please sign in to comment.