builder/docker: attempt to satisfy travis for #1993

This commit is contained in:
Donald Guy 2015-03-20 12:50:03 -04:00
parent df7623d9d8
commit a7206aebd7
1 changed files with 10 additions and 6 deletions

View File

@ -28,19 +28,23 @@ type Communicator struct {
lock sync.Mutex
}
var dockerVersion version.Version
var dockerVersion *version.Version
var useDockerExec bool
func init() {
execConstraint, _ := version.NewConstraint(">= 1.4.0")
versionExtractor := regexp.MustCompile(version.VersionRegexpRaw)
dockerVersionOutput, _ := exec.Command("docker", "-v").Output()
dockerVersionString := string(versionExtractor.FindSubmatch(dockerVersionOutput)[0])
dockerVersionOutput, err := exec.Command("docker", "-v").Output()
extractedVersion := versionExtractor.FindSubmatch(dockerVersionOutput)
dockerVersion, err := version.NewVersion(dockerVersionString)
if err != nil {
log.Printf("Docker returned malformed version string: %e", err)
if extractedVersion != nil {
dockerVersionString := string(extractedVersion[0])
dockerVersion, err = version.NewVersion(dockerVersionString)
}
if dockerVersion == nil {
log.Printf("Could not determine docker version: %v", err)
log.Printf("Assuming no `exec` capability, using `attatch`")
useDockerExec = false
} else {