| 260 | |
| 261 | |
| 262 | Try<Nothing> Docker::validateVersion(const Version& minVersion) const |
| 263 | { |
| 264 | // Validate the version (and that we can use Docker at all). |
| 265 | Future<Version> version = this->version(); |
| 266 | |
| 267 | if (!version.await(DOCKER_VERSION_WAIT_TIMEOUT)) { |
| 268 | return Error("Timed out getting docker version"); |
| 269 | } |
| 270 | |
| 271 | if (version.isFailed()) { |
| 272 | return Error("Failed to get docker version: " + version.failure()); |
| 273 | } |
| 274 | |
| 275 | if (version.get() < minVersion) { |
| 276 | string msg = "Insufficient version '" + stringify(version.get()) + |
| 277 | "' of Docker. Please upgrade to >=' " + |
| 278 | stringify(minVersion) + "'"; |
| 279 | return Error(msg); |
| 280 | } |
| 281 | |
| 282 | return Nothing(); |
| 283 | } |
| 284 | |
| 285 | |
| 286 | // TODO(josephw): Parse this string with a protobuf. |