Commit 2483041c authored by Will Starms's avatar Will Starms

Cleanup docker cache clear script

parent 04df4285
......@@ -3,9 +3,14 @@
set -e
docker version >/dev/null 2>/dev/null
CONTAINERS=$(docker ps -a | grep runner | grep project | grep concurrent | grep cache)
echo Clearing docker cache...
for container in $(echo "$CONTAINERS" | awk '{print $1}'); do
docker rm -v $container || :
done
CONTAINERS=($(docker ps -a \
--filter=status=exited \
--filter=status=dead \
--filter=label=com.gitlab.gitlab-runner.type=cache \
--format='{{.ID}}'))
if [[ -n "${CONTAINERS}" ]]; then
docker rm -v ${CONTAINERS[@]}
fi
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