From 4e0ebeaa3d5d5db7ee72ff3fe8a28a6d0f7821cc Mon Sep 17 00:00:00 2001 From: Damien Ciabrini Date: Thu, 17 Oct 2019 15:40:18 +0200 Subject: [PATCH] Less agressive cleanup of docker containers in post_upgrade_tasks "system prune -a -f" deletes unused container images, as well as containers which are stopped. This removes useful HA containers *_init_bundle and *_restart_bundle, which makes debugging more complex. This also removes tags whose image id are used by pacemaker HA container. Reduce the effect of cleanup by keeping stopped containers, which in effect ensures that we also keep the tags used by HA containers. Note: keep the aggressive cleanup for upgrade_tasks, because they are always followed by deployed tasks, which recreate the missing containers. Note2: This doesn't apply for podman containers, whose cleanup looks similar but is not as aggressive. Change-Id: I936fb965687b961602e677bcca72f403121cbb0d Closes-Bug: #1846368 (cherry picked from commit ae453229a88c0bad8482901c72a950ca729c6fc5) --- deployment/deprecated/docker/docker-baremetal-ansible.yaml | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/deployment/deprecated/docker/docker-baremetal-ansible.yaml b/deployment/deprecated/docker/docker-baremetal-ansible.yaml index ecfd7c1cd5..535df88c3b 100644 --- a/deployment/deprecated/docker/docker-baremetal-ansible.yaml +++ b/deployment/deprecated/docker/docker-baremetal-ansible.yaml @@ -239,6 +239,9 @@ outputs: systemd: name: docker register: docker_service_state - - name: Run docker system prune - shell: docker system prune -a -f + - name: Run docker image prune + shell: docker image prune -f + when: docker_service_state.status['SubState'] == 'running' + - name: Run docker volume prune + shell: docker volume prune -f when: docker_service_state.status['SubState'] == 'running'