diff options
author | Jorge Hernandez <jh1730@att.com> | 2017-10-23 14:53:01 -0500 |
---|---|---|
committer | Jorge Hernandez <jh1730@att.com> | 2017-10-23 14:55:16 -0500 |
commit | 0b477fc03482d45d37ab4b0a4cab9f59f20ceddc (patch) | |
tree | b29f29b2ba0b05add11730803d2f4c8bd080afd3 | |
parent | 6182e8cebf6fd018de36a8fab5cb8e00f643606d (diff) |
add policy clean up commands in *init script
Change-Id: Idac193367433182a3e6e7d430ccac3090c55b3b3
Issue-ID: POLICY-365
Signed-off-by: Jorge Hernandez <jh1730@att.com>
-rw-r--r-- | boot/policy_vm_init.sh | 28 |
1 files changed, 28 insertions, 0 deletions
diff --git a/boot/policy_vm_init.sh b/boot/policy_vm_init.sh index ffb26bcf..b2a7c471 100644 --- a/boot/policy_vm_init.sh +++ b/boot/policy_vm_init.sh @@ -1,5 +1,33 @@ #!/bin/bash +# destroy running instances if any + +for container in $(docker ps -q) +do + echo "stopping container ${container}" + docker stop "${container}" +done + +for container in $(docker ps -a -q) +do + echo "removing container ${container}" + docker rm -v "${container}" +done + +# remove dangling resources + +for volume in $(docker volume ls -qf dangling=true) +do + echo "removing volume ${volume}" + docker volume rm "${volume}" +done + +for image in $(docker images -f dangling=true -q) +do + echo "removing image ${image}" + docker rmi "${image}" +done + NEXUS_USERNAME=$(cat /opt/config/nexus_username.txt) NEXUS_PASSWD=$(cat /opt/config/nexus_password.txt) NEXUS_DOCKER_REPO=$(cat /opt/config/nexus_docker_repo.txt) |