Skip to content

Commit

Permalink
Fix getting container id's only for running containers
Browse files Browse the repository at this point in the history
  • Loading branch information
AMEST committed Jan 17, 2022
1 parent 4ffd14c commit 6b6e6aa
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/docker_service.py
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ def getServiceContainersId(self, service):
tasks = service.tasks({'desired-state':'running'})
if(len(tasks) == 0):
return None
return list((x['Status']['ContainerStatus']['ContainerID'] for x in tasks))
return list((x['Status']['ContainerStatus']['ContainerID'] for x in tasks if x['Status'].get('ContainerStatus') != None)) # Get container Id's only for running containers

def getServiceCpuLimitPercent(self, service):
try:
Expand Down

0 comments on commit 6b6e6aa

Please sign in to comment.