title: Docker volume cleanup of gitlab-runner
body: <p>I am new to docker and jenkins. However ultimately I am creating a job in jenkins so that I can delete the volume cache of gitlab-runner which is stored in our linux machines (CentOS7)</p>
  <p>To achieve this, I am creating a periodic job every 6 hours with the following command in jenkins:</p>
  <pre><code>docker volume prune -f 
  </code></pre>
  <p>However it doesn't clean up the space at all. This is the output of jenkins job :</p>
  <pre><code>Started by timer
  Running as SYSTEM
  Building remotely on buildbng17 (gitlab) in workspace /mnt/data0/jenkins/workspace/gitlab-cleanup
  [WS-CLEANUP] Deleting project workspace...
  [WS-CLEANUP] Deferred wipeout is used...
  [WS-CLEANUP] Done
  [gitlab-cleanup] $ /bin/sh -xe /tmp/jenkins3799570002967825583.sh
  + find /mnt/data0/gitlab/data/backups/ -name '*.tgz' -mtime +30
  /mnt/data0/gitlab/data/backups/etc-gitlab-1611415968.tgz
  Started calculate disk usage of build
  Finished Calculation of disk usage of build in 0 seconds
  Started calculate disk usage of workspace
  Finished Calculation of disk usage of workspace in 0 seconds
  Finished: SUCCESS
  </code></pre>
  <p>When I went to my buildbng17 machine and checked if there is any volume their, so there was volume which I had to clean up by performing</p>
  <pre><code>docker volume prune
  </code></pre>
  <p>The only drawback is that I need to do it manually and give that &quot;y&quot; when it asks for confirmation. And the data gets clean.</p>
  <p>What command should I give in jenkins so that it will automatically clean up the volume without asking for confirmation? (because docker volume prune -f is not working)</p>
  <p>I even tried to run the docker volume prune -f command manually in my linux machine, it still doesn't clean up the volume and shows 0kb freed up (However there is the volume which I checked from docker volume ls)</p>
  <p>Is there any better approach we can do to automate it inside gitlab-runner itself ?
  Or some better feature of jenkins or docker of which I am not aware of?</p>
  <p>The gitlab-runner keeps on running and covers the diskspace.</p>
  <p>One more thing : We are using Gitlab and Gitlab-runner on docker.</p>
  <p>Thanks in advance,
  Sameer</p>