Fix `ps` output to show all ports

Signed-off-by: Joffrey F <joffrey@docker.com>
This commit is contained in:
Joffrey F 2017-06-09 16:59:09 -07:00 committed by Joffrey F
parent f3c1c8d158
commit d527f24ff0
1 changed files with 9 additions and 5 deletions

View File

@ -96,12 +96,16 @@ class Container(object):
def human_readable_ports(self):
def format_port(private, public):
if not public:
return private
return '{HostIp}:{HostPort}->{private}'.format(
private=private, **public[0])
return [private]
return [
'{HostIp}:{HostPort}->{private}'.format(private=private, **pub)
for pub in public
]
return ', '.join(format_port(*item)
for item in sorted(six.iteritems(self.ports)))
return ', '.join(
','.join(format_port(*item))
for item in sorted(six.iteritems(self.ports))
)
@property
def labels(self):