clear-docker-cache does not clean volumes with Docker 23+

Summary

When updating Docker to 23.0.0 or newer, volumes don't get cleaned up anymore.

Steps to reproduce

  • Start out with a GitLab-Runner on Docker < 23.0
  • Update Docker to 23+
  • Run clear-docker-cache prune-volumes

Actual behavior

Observe that no volumes are removed.

Expected behavior

Volumes from previous CI runs are removed.

Used GitLab Runner version

# gitlab-runner --version
Version:      15.7.4
Git revision: d7448701
Git branch:   15-7-stable
GO version:   go1.18.9
Built:        2023-02-02T14:29:19+0000
OS/Arch:      linux/amd64

Possible fixes

  • Setting the DOCKER_API_VERSION to 1.40 makes Docker use the older behaviour, but we'd need to also insure that Docker supports this as a minimum version, otherwise some clients will complain that the API version is too high.

Workarounds

  • Use DOCKER_API_VERSION=1.40 clear-docker-cache prune-volumes
Edited by Arran Walker