lib/cide/docker.rb in cide-0.1.1 vs lib/cide/docker.rb in cide-0.2.0
- old
+ new
@@ -15,10 +15,12 @@
@exitstatus = exitstatus
super("Failed with exitstatus #{exitstatus}")
end
end
+ class VersionError < StandardError; end
+
def docker(*args, **opts)
setup_docker
ret = run Shellwords.join(['docker'] + args), opts
exitstatus = $?.exitstatus
@@ -40,9 +42,16 @@
`boot2docker shellinit 2>/dev/null`
.lines
.grep(/export (\w+)=(.*)/) { ENV[$1] = $2.strip }
end
+
+ # Check docker version
+ unless `docker version 2>/dev/null` =~ /Client version: ([^\s]+)/
+ fail VersionError, 'Unknown docker version'
+ end
+ fail VersionError, "Docker version #{$1} too old" if $1 < '1.5.0'
+
true
)
end
end
end