From 3cba27131a6cd5362d35bc0268b2a6ccd29f3e41 Mon Sep 17 00:00:00 2001 From: Flavio Percoco Date: Wed, 1 Mar 2017 14:27:57 +0100 Subject: 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 --- docker/docker-puppet.py | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'docker/docker-puppet.py') diff --git a/docker/docker-puppet.py b/docker/docker-puppet.py index d9496af6..6cee68fb 100755 --- a/docker/docker-puppet.py +++ b/docker/docker-puppet.py @@ -207,6 +207,11 @@ def mp_puppet_config((config_volume, puppet_tags, manifest, config_image, volume dcmd.extend(['--entrypoint', sh_script]) 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': print('NET_HOST enabled') dcmd.extend(['--net', 'host', '--volume', -- cgit 1.2.3-korg