Skip to content

Fix 'clear-docker-cache' script for Docker 23.0

What does this MR do?

Fixes 'clear-docker-cache' script for Docker 23.0

Why was this MR needed?

Docker 23.0 changed the existing docker system prune behaviour, and the workaround for now is to fallback to the older behaviour by explicitly specifying the older API version: https://github.com/docker/cli/issues/4028#issuecomment-1429538145

What's the best way to test this MR?

Execute the clear-docker-cache command and check that the Runner volumes are removed when running against Docker 23.0.

docker run --privileged -it -v $(pwd):/scripts --rm --entrypoint sh docker:23.0.0-dind
dockerd &
apk add bash
docker volume create --label com.gitlab.gitlab-runner.managed=true with-label-named
./scripts/clear-docker-cache prune-volumes

What are the relevant issue numbers?

Closes #29668 (closed)

Edited by Arran Walker

Merge request reports