mirror of https://github.com/docker/docs.git
Fix bug where too many '/tcp' suffixes were added to port config
This commit is contained in:
parent
18525554ed
commit
ae67d55bf2
|
@ -225,8 +225,6 @@ class Service(object):
|
||||||
port = str(port)
|
port = str(port)
|
||||||
if ':' in port:
|
if ':' in port:
|
||||||
port = port.split(':')[-1]
|
port = port.split(':')[-1]
|
||||||
if '/' not in port:
|
|
||||||
port = "%s/tcp" % port
|
|
||||||
ports.append(port)
|
ports.append(port)
|
||||||
container_options['ports'] = ports
|
container_options['ports'] = ports
|
||||||
|
|
||||||
|
|
|
@ -184,7 +184,7 @@ class ServiceTest(DockerClientTestCase):
|
||||||
def test_start_container_creates_ports(self):
|
def test_start_container_creates_ports(self):
|
||||||
service = self.create_service('web', ports=[8000])
|
service = self.create_service('web', ports=[8000])
|
||||||
container = service.start_container().inspect()
|
container = service.start_container().inspect()
|
||||||
self.assertIn('8000/tcp', container['HostConfig']['PortBindings'])
|
self.assertEqual(container['HostConfig']['PortBindings'].keys(), ['8000/tcp'])
|
||||||
self.assertNotEqual(container['HostConfig']['PortBindings']['8000/tcp'][0]['HostPort'], '8000')
|
self.assertNotEqual(container['HostConfig']['PortBindings']['8000/tcp'][0]['HostPort'], '8000')
|
||||||
|
|
||||||
def test_start_container_creates_fixed_external_ports(self):
|
def test_start_container_creates_fixed_external_ports(self):
|
||||||
|
|
Loading…
Reference in New Issue