summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorgrkiss <grakiss.wanglei@huawei.com>2017-05-01 15:50:20 -0700
committergrkiss <grakiss.wanglei@huawei.com>2017-05-01 15:50:20 -0700
commit3aeab49bb64c6c89da37f3d03f781aec85f39015 (patch)
treea78a7075647836520690982adce34acce1240b44
parent434cfad3103b8871f5eb22ceb3a2c7526b312383 (diff)
Tips on update docker to right version, > 1.8
JIRA: DOVETAIL-414 Dovetail requires docker at version > 1.8, so add some validation in code, and also versions of client and server should match with each other, or there will be unpredictable errors. Gives a notice to user to decide whether to update the docker to the latest version(1.17) Change-Id: I1331f5c19943a73e8fe25f76bd21628233e556f3 Signed-off-by: grakiss <grakiss.wanglei@huawei.com>
-rw-r--r--docker/Dockerfile5
-rwxr-xr-xdovetail/run.py1
-rw-r--r--dovetail/utils/dovetail_utils.py25
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)