List all containers including non-running ones
This commit is contained in:
parent
6085f5fc03
commit
d9e5a62458
|
@ -142,7 +142,7 @@ class Container:
|
|||
|
||||
@property
|
||||
def is_running(self) -> bool:
|
||||
"""Is the container running?"""
|
||||
"""bool: Is the container running?"""
|
||||
return self._state.get('Running', False)
|
||||
|
||||
@property
|
||||
|
@ -326,10 +326,14 @@ class RunningContainers:
|
|||
if not self.this_container:
|
||||
raise ValueError("Cannot find metadata for backup container")
|
||||
|
||||
# Gather all containers in the current compose setup
|
||||
# Gather all running containers in the current compose setup
|
||||
for container_data in all_containers:
|
||||
container = Container(container_data)
|
||||
|
||||
# We only care about running containers
|
||||
if not container.is_running:
|
||||
continue
|
||||
|
||||
# Detect running backup process container
|
||||
if container.is_backup_process_container:
|
||||
self.backup_process_container = container
|
||||
|
|
|
@ -16,7 +16,7 @@ def list_containers():
|
|||
"""
|
||||
config = Config()
|
||||
client = docker.DockerClient(base_url=config.docker_base_url)
|
||||
all_containers = client.containers.list()
|
||||
all_containers = client.containers.list(all=True)
|
||||
client.close()
|
||||
return [c.attrs for c in all_containers]
|
||||
|
||||
|
|
Loading…
Reference in New Issue