mirror of https://github.com/docker/docker-py.git
Fixed value for missing host port for newer docker desktop versions
Signed-off-by: Ben Avrahami <avrahami.ben@gmail.com>
This commit is contained in:
parent
a9748a8b70
commit
9f3f97ce94
|
@ -88,7 +88,7 @@ def _convert_port_binding(binding):
|
||||||
result['HostPort'] = binding
|
result['HostPort'] = binding
|
||||||
|
|
||||||
if result['HostPort'] is None:
|
if result['HostPort'] is None:
|
||||||
result['HostPort'] = ''
|
result['HostPort'] = '0'
|
||||||
else:
|
else:
|
||||||
result['HostPort'] = str(result['HostPort'])
|
result['HostPort'] = str(result['HostPort'])
|
||||||
|
|
||||||
|
|
|
@ -577,7 +577,7 @@ class CreateContainerTest(BaseAPIClientTest):
|
||||||
assert '4444/tcp' in port_bindings
|
assert '4444/tcp' in port_bindings
|
||||||
assert '5555/tcp' in port_bindings
|
assert '5555/tcp' in port_bindings
|
||||||
assert '6666/tcp' in port_bindings
|
assert '6666/tcp' in port_bindings
|
||||||
assert [{"HostPort": "", "HostIp": ""}] == port_bindings['1111/tcp']
|
assert [{"HostPort": "0", "HostIp": ""}] == port_bindings['1111/tcp']
|
||||||
assert [
|
assert [
|
||||||
{"HostPort": "2222", "HostIp": ""}
|
{"HostPort": "2222", "HostIp": ""}
|
||||||
] == port_bindings['2222/tcp']
|
] == port_bindings['2222/tcp']
|
||||||
|
|
|
@ -163,7 +163,7 @@ class ContainerCollectionTest(unittest.TestCase):
|
||||||
'PidsLimit': 500,
|
'PidsLimit': 500,
|
||||||
'PortBindings': {
|
'PortBindings': {
|
||||||
'1111/tcp': [{'HostIp': '', 'HostPort': '4567'}],
|
'1111/tcp': [{'HostIp': '', 'HostPort': '4567'}],
|
||||||
'2222/tcp': [{'HostIp': '', 'HostPort': ''}]
|
'2222/tcp': [{'HostIp': '', 'HostPort': '0'}]
|
||||||
},
|
},
|
||||||
'Privileged': True,
|
'Privileged': True,
|
||||||
'PublishAllPorts': True,
|
'PublishAllPorts': True,
|
||||||
|
|
Loading…
Reference in New Issue