mirror of https://github.com/docker/docs.git
Resolves #43 - sort containers in ps output by name, so services are grouped together.
Signed-off-by: Daniel Nephin <dnephin@gmail.com>
This commit is contained in:
parent
fc4c35e977
commit
192fce9153
|
@ -4,6 +4,7 @@ import logging
|
||||||
import sys
|
import sys
|
||||||
import re
|
import re
|
||||||
import signal
|
import signal
|
||||||
|
from operator import attrgetter
|
||||||
|
|
||||||
from inspect import getdoc
|
from inspect import getdoc
|
||||||
import dockerpty
|
import dockerpty
|
||||||
|
@ -180,7 +181,10 @@ class TopLevelCommand(Command):
|
||||||
Options:
|
Options:
|
||||||
-q Only display IDs
|
-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']:
|
if options['-q']:
|
||||||
for container in containers:
|
for container in containers:
|
||||||
|
|
Loading…
Reference in New Issue