Not to pull the base images when building.

Add --pull/--nopull parameter for kolla-build, when --nopull is
given and the base image is already loaded, The docker-engine will
not attemp to pull a newer version of the image. This makes sense
when the registry server of base images is unreachable.

This feature is as same to setting "image_pull_policy" to
"IfNotPresent" while building images.

The reason why I create this feature is that, even if I have setted
base_distro_tag to a stable tag, e.g. "7" or "2016-12-13", docker
still have to wait much time to fetch the version, and return failure
when registry server is unreachable. This is a feature of docker
build --pull=True.

Change-Id: If1bd08763fb757b4f090a3163dd1dbfb8fc531d3
Implements: blueprint docker-build-nopull-base
This commit is contained in:
dupengfei 2016-12-09 11:47:05 +08:00
parent 5bbab143b4
commit 9813ef84b7
3 changed files with 9 additions and 1 deletions

2
kolla/common/config.py Normal file → Executable file
View File

@ -205,6 +205,8 @@ _CLI_OPTS = [
cfg.StrOpt('template-override',
help='Path to template override file'),
cfg.StrOpt('logs-dir', help='Path to logs directory'),
cfg.BoolOpt('pull', default=True,
help='Attempt to pull a newer version of the base image.'),
]
_BASE_OPTS = [

View File

@ -401,7 +401,7 @@ class BuildTask(DockerTask):
tar.add(plugins_path, arcname='plugins')
# Pull the latest image for the base distro only
pull = True if image.parent is None else False
pull = self.conf.pull if image.parent is None else False
buildargs = self.update_buildargs()
try:

View File

@ -0,0 +1,6 @@
---
features:
- Add --pull/--nopull parameter for kolla-build, when --nopull is given and
the base image is already loaded, The docker-engine will not attempt to
pull a newer version of the image. This makes sense when the registry
server of base images is unreachable.