diff options
author | Devan Goodwin <dgoodwin@redhat.com> | 2016-08-11 11:30:19 -0300 |
---|---|---|
committer | Devan Goodwin <dgoodwin@redhat.com> | 2016-08-11 11:30:19 -0300 |
commit | b89c835e3235f2628b37de15713c311d1b5a4bad (patch) | |
tree | 5f067223dc672b7d066c836f45ad6fae1d5e36a2 /playbooks/common/openshift-cluster/upgrades/files/nuke_images.sh | |
parent | f67fcebdf7dde847c39b0ed450ce7267f2945ebe (diff) | |
download | openshift-b89c835e3235f2628b37de15713c311d1b5a4bad.tar.gz openshift-b89c835e3235f2628b37de15713c311d1b5a4bad.tar.bz2 openshift-b89c835e3235f2628b37de15713c311d1b5a4bad.tar.xz openshift-b89c835e3235f2628b37de15713c311d1b5a4bad.zip |
Improvements for Docker 1.10+ upgrade image nuking.
In a parallel step prior to real upgrade tasks, clear out all unused
Docker images on all hosts. This should be relatively safe to interrupt
as no real upgrade steps have taken place.
Once into actual upgrade, we again clear all images only this time with
force, and after stopping and removing all containers.
Both rmi commands use a new and hopefully less error prone command to do
the removal, this should avoid missed orphans as we were hitting before.
Added some logging around the current image count before and after this
step, most of them are only printed if we're crossing the 1.10 boundary
but one does not, just for additional information in your ansible log.
Diffstat (limited to 'playbooks/common/openshift-cluster/upgrades/files/nuke_images.sh')
-rw-r--r-- | playbooks/common/openshift-cluster/upgrades/files/nuke_images.sh | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/playbooks/common/openshift-cluster/upgrades/files/nuke_images.sh b/playbooks/common/openshift-cluster/upgrades/files/nuke_images.sh index 6b155f7fa..8635eab0d 100644 --- a/playbooks/common/openshift-cluster/upgrades/files/nuke_images.sh +++ b/playbooks/common/openshift-cluster/upgrades/files/nuke_images.sh @@ -15,9 +15,11 @@ then fi # Delete all images (forcefully) -image_ids=`docker images -q` +image_ids=`docker images -aq` if test -n "$image_ids" then - # Taken from: https://gist.github.com/brianclements/f72b2de8e307c7b56689#gistcomment-1443144 - docker rmi $(docker images | grep "$2/\|/$2 \| $2 \|$2 \|$2-\|$2_" | awk '{print $1 ":" $2}') 2>/dev/null || echo "No images matching \"$2\" left to purge." + # Some layers are deleted recursively and are no longer present + # when docker goes to remove them: + docker rmi -f `docker images -aq` || true fi + |