From 5ea835e6956beb9609b4c88bfcc1ddead17fd141 Mon Sep 17 00:00:00 2001 From: Joachim Lusiardi Date: Tue, 5 Apr 2016 18:58:22 +0200 Subject: [PATCH] publishing the port is not required anymore The autoproxy container is not requiring that port 80 must be published anymore. This is usefull in cases when again another proxy container is build up in front. --- nginx_proxy.py | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/nginx_proxy.py b/nginx_proxy.py index 7d9db70..089a96f 100755 --- a/nginx_proxy.py +++ b/nginx_proxy.py @@ -135,10 +135,14 @@ def get_docker_id(): def get_listen_ips(): inspect_data = client.inspect_container(get_docker_id()) - logging.info('count %s', len(inspect_data['NetworkSettings']['Ports']['80/tcp'])) + mappings = inspect_data['NetworkSettings']['Ports']['80/tcp'] ips = [] - for data in inspect_data['NetworkSettings']['Ports']['80/tcp']: - ips.append(data['HostIp']) + if mappings is None or len(mappings) == 0: + ips.append('0.0.0.0') + else: + logging.info('count %s', len(mappings)) + for data in mappings: + ips.append(data['HostIp']) return ips def setup_logging():