|
@@ -635,6 +635,7 @@ class TopLevelCommand(object):
|
|
|
|
|
|
Options:
|
|
|
-f, --force Don't ask to confirm removal
|
|
|
+ -s, --stop Stop the containers, if required, before removing
|
|
|
-v Remove any anonymous volumes attached to containers
|
|
|
-a, --all Deprecated - no effect.
|
|
|
"""
|
|
@@ -645,6 +646,15 @@ class TopLevelCommand(object):
|
|
|
)
|
|
|
one_off = OneOffFilter.include
|
|
|
|
|
|
+ if options.get('--stop'):
|
|
|
+ running_containers = self.project.containers(
|
|
|
+ service_names=options['SERVICE'], stopped=False, one_off=one_off
|
|
|
+ )
|
|
|
+ self.project.stop(
|
|
|
+ service_names=running_containers,
|
|
|
+ one_off=one_off
|
|
|
+ )
|
|
|
+
|
|
|
all_containers = self.project.containers(
|
|
|
service_names=options['SERVICE'], stopped=True, one_off=one_off
|
|
|
)
|