Improve scripts with some check before kick rm command

Closes-Bug: #1490387
Change-Id: I4a9476085b9c5b2cae3801e5b1954e85068f4e03
This commit is contained in:
Kai Qiang Wu(Kennan) 2015-08-31 04:14:17 +00:00
parent 5f621a4fe9
commit da68e2eccc
2 changed files with 12 additions and 3 deletions

View File

@ -1,3 +1,7 @@
#!/bin/bash
docker rm $@ $(docker ps -a -q)
CONTAINERS=`docker ps -a -q`
if [[ -z "$CONTAINERS" ]]; then
echo "No containers to cleanup, exit now."
exit 0
fi
docker rm $@ $CONTAINERS

View File

@ -6,4 +6,9 @@ cd "$(dirname "$REAL_PATH")/.."
. tools/validate-docker-execute
docker rmi $@ $(docker images -a -q)
IMAGES=`docker images -a -q`
if [[ -z "$IMAGES" ]]; then
echo "No images to cleanup, exit now."
exit 0
fi
docker rmi $@ $IMAGES