Ignore containers that don't have a name
If a container is in the process of being removed, or removal has failed, it can sometimes appear in the output of GET /containers/json but not have a 'Name' key. In that case, rather than crashing, we can ignore it. Signed-off-by: Aanand Prasad <aanand.prasad@gmail.com>
This commit is contained in:
parent
6cb8e512f2
commit
dfa4bf4452
6 changed files with 64 additions and 11 deletions
|
|
@ -310,11 +310,11 @@ class Project(object):
|
|||
else:
|
||||
service_names = self.service_names
|
||||
|
||||
containers = [
|
||||
containers = filter(None, [
|
||||
Container.from_ps(self.client, container)
|
||||
for container in self.client.containers(
|
||||
all=stopped,
|
||||
filters={'label': self.labels(one_off=one_off)})]
|
||||
filters={'label': self.labels(one_off=one_off)})])
|
||||
|
||||
def matches_service_names(container):
|
||||
return container.labels.get(LABEL_SERVICE) in service_names
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue