Skip to content

Commit 4171a89

Browse files
authored
Merge pull request #16 from phase2/bug/docker-ce-version-fix
Handle versions more broadly to account for the new Docker versioning scheme
2 parents 7a27b05 + 570254c commit 4171a89

File tree

2 files changed

+8
-4
lines changed

2 files changed

+8
-4
lines changed

cli/commands/machine.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ type Machine struct {
2323
func (m *Machine) Create(driver string, cpuCount string, memSize string, diskSize string) {
2424
m.out.Info.Printf("Creating a %s machine named '%s' with CPU(%s) MEM(%s) DISK(%s)...", driver, m.Name, cpuCount, memSize, diskSize)
2525

26-
boot2dockerUrl := "https://github.com/boot2docker/boot2docker/releases/download/v" + util.GetCurrentDockerVersion().String() + "/boot2docker.iso"
26+
boot2dockerUrl := "https://github.com/boot2docker/boot2docker/releases/download/v" + util.GetRawCurrentDockerVersion() + "/boot2docker.iso"
2727

2828
var create *exec.Cmd
2929

cli/util/util.go

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -62,10 +62,14 @@ func AskYesNo(question string) bool {
6262

6363
}
6464

65-
func GetCurrentDockerVersion() *version.Version {
65+
func GetRawCurrentDockerVersion() string {
6666
output, _ := exec.Command("docker", "--version").Output()
67-
re := regexp.MustCompile("Docker version ([\\d|\\.]+)")
68-
versionNumber := re.FindAllStringSubmatch(string(output), -1)[0][1]
67+
re := regexp.MustCompile("Docker version (.*),")
68+
return re.FindAllStringSubmatch(string(output), -1)[0][1]
69+
}
70+
71+
func GetCurrentDockerVersion() *version.Version {
72+
versionNumber := GetRawCurrentDockerVersion()
6973
return version.Must(version.NewVersion(versionNumber))
7074
}
7175

0 commit comments

Comments
 (0)