Merge pull request #1406 from vdemeester/667-compose-port-scale

Fixing docker-compose port with scale (#667)
This commit is contained in:
Aanand Prasad 2015-06-15 10:58:44 -07:00
commit 5b2a0cc73d
3 changed files with 32 additions and 3 deletions

View file

@ -172,13 +172,14 @@ class TopLevelCommand(Command):
Usage: port [options] SERVICE PRIVATE_PORT
Options:
--protocol=proto tcp or udp (defaults to tcp)
--protocol=proto tcp or udp [default: tcp]
--index=index index of the container if there are multiple
instances of a service (defaults to 1)
instances of a service [default: 1]
"""
index = int(options.get('--index'))
service = project.get_service(options['SERVICE'])
try:
container = service.get_container(number=options.get('--index') or 1)
container = service.get_container(number=index)
except ValueError as e:
raise UserError(str(e))
print(container.get_local_port(