diff options
-rw-r--r-- | docker/Dockerfile | 5 | ||||
-rwxr-xr-x | dovetail/run.py | 1 | ||||
-rw-r--r-- | dovetail/utils/dovetail_utils.py | 25 |
3 files changed, 30 insertions, 1 deletions
diff --git a/docker/Dockerfile b/docker/Dockerfile index 8cc15e0b..7b3d99ed 100644 --- a/docker/Dockerfile +++ b/docker/Dockerfile @@ -13,9 +13,12 @@ RUN \ python-mock \ python-pip \ apt-transport-https \ + wget \ --no-install-recommends \ && \ - apt-get update && apt-get -y install docker.io + apt-get update + +RUN wget -qO- https://get.docker.com/ | sh ENV HOME /home/opnfv ENV REPOS_DIR ${HOME}/dovetail diff --git a/dovetail/run.py b/dovetail/run.py index 607e1b15..4bea9b53 100755 --- a/dovetail/run.py +++ b/dovetail/run.py @@ -204,6 +204,7 @@ def main(*args, **kwargs): logger.info('Dovetail compliance: %s!', (kwargs['testsuite'])) logger.info('================================================') logger.info('Build tag: %s', dt_cfg.dovetail_config['build_tag']) + dt_utils.check_docker_version(logger) validate_input(kwargs, dt_cfg.dovetail_config['validate_input'], logger) configs = filter_config(kwargs, logger) diff --git a/dovetail/utils/dovetail_utils.py b/dovetail/utils/dovetail_utils.py index 020617b8..7b613488 100644 --- a/dovetail/utils/dovetail_utils.py +++ b/dovetail/utils/dovetail_utils.py @@ -17,6 +17,7 @@ from collections import Mapping, Set, Sequence import json import urllib2 from datetime import datetime +from distutils.version import LooseVersion def exec_log(verbose, logger, msg, level, flush=False): @@ -165,3 +166,27 @@ def show_progress_bar(length): sys.stdout.flush() sys.stdout.write('Running ' + '.' * length + '\r') sys.stdout.flush() + + +def check_docker_version(logger=None): + ret, server_ver = exec_cmd("docker version -f'{{.Server.Version}}'", + logger=logger) + ret, client_ver = exec_cmd("docker version -f'{{.Client.Version}}'", + logger=logger) + logger.info("\ndocker version: \nclient:%s\nservr:%s", client_ver, + server_ver) + if(LooseVersion(client_ver) <= LooseVersion('1.8.0') or + LooseVersion(server_ver) <= LooseVersion('1.8.0')): + logger.warn("\n\nDocker version is too old, may cause unpredictable " + "errors, you can update or install the lastest docker " + "for both host and container as below:\nwget -qO- " + "https://get.docker.com/ | sh\n\nClient:%s\nServer:%s", + client_ver, server_ver) + exit(-1) + + if(client_ver != server_ver): + logger.warn("\n\nVersion mismatch, may cause unpredictable " + "errors, you can update or install the lastest " + "docker for both host and container as below:\nwget " + "-qO- https://get.docker.com/ | " + "sh\n\nClient:%s\nServer:%s", client_ver, server_ver) |