From 24f45e4eba56f0e69580e325b4a7b4eab0c59751 Mon Sep 17 00:00:00 2001 From: Sven Dowideit Date: Wed, 19 Jul 2017 11:44:33 +1000 Subject: [PATCH] fix finding dockerd so 17.06 works Signed-off-by: Sven Dowideit --- cmd/control/docker_init.go | 24 ++++++++++++++++++------ 1 file changed, 18 insertions(+), 6 deletions(-) diff --git a/cmd/control/docker_init.go b/cmd/control/docker_init.go index ea630c7f..3ae75c57 100644 --- a/cmd/control/docker_init.go +++ b/cmd/control/docker_init.go @@ -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)