Query containers using the most recent API version

This means we will also get the Config section with env vars
This commit is contained in:
Einar Forselv 2019-04-18 03:49:47 +02:00
parent dd091041b8
commit 6bcb31da98
1 changed files with 9 additions and 4 deletions

View File

@ -4,9 +4,14 @@ from restic_volume_backup.config import Config
def list_containers():
"""Easily mockable container list"""
"""
List all containers.
Returns:
List of raw container json data from the api
"""
config = Config()
client = docker.APIClient(base_url=config.docker_base_url)
all_containers = client.containers()
client = docker.DockerClient(base_url=config.docker_base_url)
all_containers = client.containers.list()
client.close()
return all_containers
return [c.attrs for c in all_containers]