Skip to content

Commit adf5a1c

Browse files
committed
Use get instead of bracket notation
1 parent c0df903 commit adf5a1c

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

docker/client.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -735,7 +735,7 @@ def port(self, container, private_port):
735735

736736
# Port settings is None when the container is running with
737737
# network_mode=host.
738-
port_settings = json_['NetworkSettings']['Ports']
738+
port_settings = json_.get('NetworkSettings', {}).get('Ports')
739739
if port_settings is None:
740740
return None
741741

0 commit comments

Comments
 (0)