Fix clear-docker-cache script for Docker 29

What does this MR do?

Docker made a change in behaviour some time ago to how volumes are pruned. The quickest fix for this at the time was to explicitly set the DOCKER_API_VERSION.

Docker have since removed support for the API version we were relying on. So a new fix was needed.

This MR adds a combination of docker system prune and docker volume prune, for various Docker client versions that introduced new flags to these commands.

What's the best way to test this MR?

  • Run the script locally
  • You can check the various flags and when introduced with docker run -it --rm docker:<version> system prune --help and docker run -it --rm docker:<version> volume prune --help, where <version> is:
    • 17.03.0-git
    • 17.04.0-git
    • 17.05.0-git
    • 23
    • 29

What are the relevant issue numbers?

Closes #39117 (closed) Closes #39101 (closed)

Merge request reports

Loading