builder/docker: attempt to satisfy travis for #1993
This commit is contained in:
parent
df7623d9d8
commit
a7206aebd7
|
@ -28,19 +28,23 @@ type Communicator struct {
|
||||||
lock sync.Mutex
|
lock sync.Mutex
|
||||||
}
|
}
|
||||||
|
|
||||||
var dockerVersion version.Version
|
var dockerVersion *version.Version
|
||||||
var useDockerExec bool
|
var useDockerExec bool
|
||||||
|
|
||||||
func init() {
|
func init() {
|
||||||
execConstraint, _ := version.NewConstraint(">= 1.4.0")
|
execConstraint, _ := version.NewConstraint(">= 1.4.0")
|
||||||
|
|
||||||
versionExtractor := regexp.MustCompile(version.VersionRegexpRaw)
|
versionExtractor := regexp.MustCompile(version.VersionRegexpRaw)
|
||||||
dockerVersionOutput, _ := exec.Command("docker", "-v").Output()
|
dockerVersionOutput, err := exec.Command("docker", "-v").Output()
|
||||||
dockerVersionString := string(versionExtractor.FindSubmatch(dockerVersionOutput)[0])
|
extractedVersion := versionExtractor.FindSubmatch(dockerVersionOutput)
|
||||||
|
|
||||||
dockerVersion, err := version.NewVersion(dockerVersionString)
|
if extractedVersion != nil {
|
||||||
if err != nil {
|
dockerVersionString := string(extractedVersion[0])
|
||||||
log.Printf("Docker returned malformed version string: %e", err)
|
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`")
|
log.Printf("Assuming no `exec` capability, using `attatch`")
|
||||||
useDockerExec = false
|
useDockerExec = false
|
||||||
} else {
|
} else {
|
||||||
|
|
Loading…
Reference in New Issue