Make clear-docker-cache script to work for Docker versions below 17.06.1
What does this MR do?
This MR makes the clear-docker-cache
script to work for Docker versions below 17.06.1
Why was this MR needed?
Currently, the clear-docker-cache
script fails when using a Docker version between 1.13 and 17.06.1.
[root@gitlab-runner ~]# gitlab-runner --version
Version: 14.9.1
Git revision: f188edd7
Git branch: 14-9-stable
GO version: go1.17.7
Built: 2022-03-22T20:45:44+0000
OS/Arch: linux/amd64
[root@gitlab-runner ~]# docker version
Client:
Version: 1.13.1
API version: 1.26
Package version: docker-1.13.1-209.git7d71120.el7_9.x86_64
Go version: go1.10.3
Git commit: 7d71120/1.13.1
Built: Fri Jan 7 13:15:46 2022
OS/Arch: linux/amd64
Server:
Version: 1.13.1
API version: 1.26 (minimum version 1.12)
Package version: docker-1.13.1-209.git7d71120.el7_9.x86_64
Go version: go1.10.3
Git commit: 7d71120/1.13.1
Built: Fri Jan 7 13:15:46 2022
OS/Arch: linux/amd64
Experimental: false
[root@gitlab-runner ~]# /usr/share/gitlab-runner/clear-docker-cache
Check and remove all unused containers (both dangling and unreferenced) including volumes.
------------------------------------------------------------------------------------------
unknown flag: --volumes
See 'docker system prune --help'.
The --volumes
flag in docker system prune
was introduced in Docker client version 17.06.1: https://docs.docker.com/engine/release-notes/17.06/#client-1
What's the best way to test this MR?
Test script with different Docker versions (1.13, 17.06.1)
What are the relevant issue numbers?
No issue opened
Edited by Roland Hügli