Pass the DOCKER_* env vars when running docker

We should always pass the `DOCKER_*` env vars to all the `docker`
commands that are executed in the various scripts as those variables may
contain the access data for the docker daemon.

Change-Id: Ie719f451350e6ea35cb22d97a8f090ad81fa8141
This commit is contained in:
Flavio Percoco 2017-03-01 14:27:57 +01:00
parent de1637bdd1
commit 3cba27131a

View File

@ -207,6 +207,11 @@ def mp_puppet_config((config_volume, puppet_tags, manifest, config_image, volume
dcmd.extend(['--entrypoint', sh_script]) dcmd.extend(['--entrypoint', sh_script])
env = {} env = {}
# NOTE(flaper87): Always copy the DOCKER_* environment variables as
# they contain the access data for the docker daemon.
for k in filter(lambda k: k.startswith('DOCKER'), os.environ.keys()):
env[k] = os.environ.get(k)
if os.environ.get('NET_HOST', 'false') == 'true': if os.environ.get('NET_HOST', 'false') == 'true':
print('NET_HOST enabled') print('NET_HOST enabled')
dcmd.extend(['--net', 'host', '--volume', dcmd.extend(['--net', 'host', '--volume',