Merge pull request #483 from dnephin/sort_containers_by_name_in_ps

Sort containers in ps output by name
This commit is contained in:
Aanand Prasad 2014-09-26 10:18:08 -07:00
commit 5d76d183b4
1 changed files with 5 additions and 1 deletions

View File

@ -4,6 +4,7 @@ import logging
import sys
import re
import signal
from operator import attrgetter
from inspect import getdoc
import dockerpty
@ -180,7 +181,10 @@ class TopLevelCommand(Command):
Options:
-q Only display IDs
"""
containers = project.containers(service_names=options['SERVICE'], stopped=True) + project.containers(service_names=options['SERVICE'], one_off=True)
containers = sorted(
project.containers(service_names=options['SERVICE'], stopped=True) +
project.containers(service_names=options['SERVICE'], one_off=True),
key=attrgetter('name'))
if options['-q']:
for container in containers: