aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMichal (inc0) Jastrzebski <inc007@gmail.com>2016-06-14 15:12:02 +0000
committerMichal (inc0) Jastrzebski <inc007@gmail.com>2016-06-14 16:59:41 +0000
commitf76e9a1e0d6ff5f0f4326bc51659027216bd8afc (patch)
tree78e6c2eb9a7f588443ca84dbb76bfc28195287e4
parente6c1d4178215b1dc51ddb032dec0b13e67d644b8 (diff)
downloadkolla-ansible-f76e9a1e0d6ff5f0f4326bc51659027216bd8afc.tar.gz
kolla-ansible-f76e9a1e0d6ff5f0f4326bc51659027216bd8afc.zip
Make cleanup remove restarting/exited containers
If we have bug in contianer or it simplt somehow ended up in Exited state, cleanup doesn't flush it. It also means it doesn't flush volumes and that might cause an dirty env. Closes-Bug: #1587344 Change-Id: Ib5705992500ce7efdc66509df61c381bd33d1954
-rwxr-xr-xtools/cleanup-containers2
1 files changed, 1 insertions, 1 deletions
diff --git a/tools/cleanup-containers b/tools/cleanup-containers
index 412da2f2e..14249c960 100755
--- a/tools/cleanup-containers
+++ b/tools/cleanup-containers
@@ -10,7 +10,7 @@ if [ -n "$1" ]; then
containers_to_kill=($(docker ps | grep -E "$1" | awk '{print $1}'))
volumes_to_remove=($(docker volume ls | grep -E "$1" | awk '{print $1}'))
else
- containers_to_kill=$(docker ps --filter "label=kolla_version" --format "{{.Names}}")
+ containers_to_kill=$(docker ps --filter "label=kolla_version" --format "{{.Names}}" -a)
volumes_to_remove=$(docker inspect -f '{{range .Mounts}} {{printf "%s\n" .Name }}{{end}}' ${containers_to_kill} | \
egrep -v '(^\s*$)' | sort | uniq)