Commit af878718 authored by Jürgen Haas's avatar Jürgen Haas

Fix reset function for each loops (again)

parent 68c8c4f3
......@@ -5,30 +5,30 @@ function removecontainer {
ID=$(docker container ls --all -q -f ancestor=$1 | head -1)
if [[ -n ${ID} ]]; then
echo "Removing outdated container ..."
docker kill ${ID} >/dev/null
docker rm ${ID} >/dev/null
docker kill ${ID} >/dev/null 2>&1
docker rm ${ID} >/dev/null 2>&1
else
break
fi
done
if [[ "$2" == "rmi" ]]; then
echo "Removing outdated image ..."
docker rmi $1 >/dev/null
docker rmi $1 >/dev/null 2>&1
fi
}
function cleanup {
if [[ $L3D_FORCE_UPDATE -eq 1 ]]; then
IMAGEIDS=( $(docker image ls -q registry.lakedrops.com/docker/l3d/php-${PHP_VERSION}) )
for IMAGEID in $IMAGEIDS; do
docker image ls -q registry.lakedrops.com/docker/l3d/php-${PHP_VERSION} > /tmp/reset.lst
for IMAGEID in `cat /tmp/reset.lst`; do
removecontainer $IMAGEID
done
else
IMAGEID=$(docker image ls -q registry.lakedrops.com/docker/l3d/php-${PHP_VERSION}:${VERSION} | head -1)
removecontainer $IMAGEID rmi
fi
IMAGEIDS=( $(docker image ls -q registry.lakedrops.com/docker/node) )
for IMAGEID in $IMAGEIDS; do
docker image ls -q registry.lakedrops.com/docker/node > /tmp/reset.lst
for IMAGEID in `cat /tmp/reset.lst`; do
removecontainer $IMAGEID
done
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment