From 2527ef8055410ee5100631da807ed650ec64c36f Mon Sep 17 00:00:00 2001 From: dano Date: Sat, 6 Jun 2015 15:12:13 -0400 Subject: [PATCH] Validate that service names passed to Project.containers aren't bogus. Signed-off-by: Dan O'Reilly --- compose/project.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/compose/project.py b/compose/project.py index d3deeeaf9..e6ec6d676 100644 --- a/compose/project.py +++ b/compose/project.py @@ -274,6 +274,9 @@ class Project(object): service.remove_stopped(**options) def containers(self, service_names=None, stopped=False, one_off=False): + if service_names: + # Will raise NoSuchService if one of the names is invalid + self.get_services(service_names) containers = [ Container.from_ps(self.client, container) for container in self.client.containers(