diff options
author | Scott Dodson <sdodson@redhat.com> | 2017-02-02 09:17:08 -0500 |
---|---|---|
committer | GitHub <noreply@github.com> | 2017-02-02 09:17:08 -0500 |
commit | 4dfe8c715bfc49a913d7c7bea80c475a9b50b41e (patch) | |
tree | 764be64a50670d9aeda1798ecdbe8746a14a7b4b /roles/openshift_node_upgrade/files/nuke_images.sh | |
parent | c9480811d2222693abe4460ca42c292b289a0ef4 (diff) | |
parent | 43ecd7bf94d5be4209e46d66a9f9bd9614d85a76 (diff) | |
download | openshift-4dfe8c715bfc49a913d7c7bea80c475a9b50b41e.tar.gz openshift-4dfe8c715bfc49a913d7c7bea80c475a9b50b41e.tar.bz2 openshift-4dfe8c715bfc49a913d7c7bea80c475a9b50b41e.tar.xz openshift-4dfe8c715bfc49a913d7c7bea80c475a9b50b41e.zip |
Merge pull request #3242 from ingvagabund/create-node-upgrade-role
Move current node upgrade tasks under openshift_node_upgrade role
Diffstat (limited to 'roles/openshift_node_upgrade/files/nuke_images.sh')
-rw-r--r-- | roles/openshift_node_upgrade/files/nuke_images.sh | 25 |
1 files changed, 25 insertions, 0 deletions
diff --git a/roles/openshift_node_upgrade/files/nuke_images.sh b/roles/openshift_node_upgrade/files/nuke_images.sh new file mode 100644 index 000000000..8635eab0d --- /dev/null +++ b/roles/openshift_node_upgrade/files/nuke_images.sh @@ -0,0 +1,25 @@ +#!/bin/bash + +# Stop any running containers +running_container_ids=`docker ps -q` +if test -n "$running_container_ids" +then + docker stop $running_container_ids +fi + +# Delete all containers +container_ids=`docker ps -a -q` +if test -n "$container_ids" +then + docker rm -f -v $container_ids +fi + +# Delete all images (forcefully) +image_ids=`docker images -aq` +if test -n "$image_ids" +then + # Some layers are deleted recursively and are no longer present + # when docker goes to remove them: + docker rmi -f `docker images -aq` || true +fi + |