diff --git a/tests.sh b/tests.sh index 9580348..fcc56fe 100644 --- a/tests.sh +++ b/tests.sh @@ -190,6 +190,10 @@ cleanup() { restore_backup "$CFG_DOCKER" systemctl restart docker.service + log "Removing images and containers..." + docker ps -aq | xargs docker rm -f + docker images -q | xargs docker rmi -f + log "Removing extra files and restoring backups..." restore_backup /etc/subuid /etc/subgid rm -f "$TESTS_DIR/contrib" "$DEST/fixtures" "$FROZEN_IMAGES_LINK" @@ -203,6 +207,10 @@ export MAKEDIR="$SCRIPTS_DIR/make" export DOCKER_HOST="$DOCKER_TEST_HOST" bundle .integration-daemon-setup +# Clean up all images on the host -- this is key to avoid test run failures. +docker ps -aq | xargs docker rm -f +docker images -q | xargs docker rmi -f + # XXX: Really this should be sourced from the Dockerfile but this is good # enough for now. This comes from the Docker 18.09.1-ce Dockerfile. log "Downlading frozen images..."