From 6bcb31da9887f9e81aae7c51aa3937b2c0514152 Mon Sep 17 00:00:00 2001 From: Einar Forselv Date: Thu, 18 Apr 2019 03:49:47 +0200 Subject: [PATCH] Query containers using the most recent API version This means we will also get the Config section with env vars --- restic_volume_backup/utils.py | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/restic_volume_backup/utils.py b/restic_volume_backup/utils.py index b3d0efb..734636e 100644 --- a/restic_volume_backup/utils.py +++ b/restic_volume_backup/utils.py @@ -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]