Kaydet (Commit) c0df903a authored tarafından Joffrey F's avatar Joffrey F

Merge branch 'fix-port-host-net' of https://github.com/ssanderson/docker-py into…

Merge branch 'fix-port-host-net' of https://github.com/ssanderson/docker-py into ssanderson-fix-port-host-net
......@@ -733,9 +733,15 @@ class Client(requests.Session):
s_port = str(private_port)
h_ports = None
h_ports = json_['NetworkSettings']['Ports'].get(s_port + '/udp')
# Port settings is None when the container is running with
# network_mode=host.
port_settings = json_['NetworkSettings']['Ports']
if port_settings is None:
return None
h_ports = port_settings.get(s_port + '/udp')
if h_ports is None:
h_ports = json_['NetworkSettings']['Ports'].get(s_port + '/tcp')
h_ports = port_settings.get(s_port + '/tcp')
return h_ports
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment