summaryrefslogtreecommitdiff
path: root/trove/guestagent/utils/docker.py
diff options
context:
space:
mode:
Diffstat (limited to 'trove/guestagent/utils/docker.py')
-rw-r--r--trove/guestagent/utils/docker.py8
1 files changed, 8 insertions, 0 deletions
diff --git a/trove/guestagent/utils/docker.py b/trove/guestagent/utils/docker.py
index da3ad412..0fdda049 100644
--- a/trove/guestagent/utils/docker.py
+++ b/trove/guestagent/utils/docker.py
@@ -151,3 +151,11 @@ def get_container_logs(client, name='database', tail=50):
container = client.containers.get(name)
output = container.logs(tail=tail)
return _decode_output(output)
+
+
+def prune_images(client):
+ """Remove unused images."""
+ try:
+ client.images.prune(filters={'dangling': False})
+ except Exception as e:
+ LOG.warning(f"Prune image failed, error: {str(e)}")