Cache in self-managed Runner

I’m not getting any cache hits when jobs run on the docker Runner that I have locally (builds are passing fine, just no cache hits). This is my gitlab-runner.yml

concurrent = 4
check_interval = 0

  name = "<elided>"
  url = ""
  token = "<elided>"
  executor = "docker"
    tls_verify = false
    image = "fommil/docker-openjdk-sbt:latest"
    privileged = false
    disable_cache = false
    cache_dir = "/var/lib/gitlab-runner/"
    volumes = ["/var/lib/gitlab-runner/"]
    shm_size = 0

which is following as best I can

Even when the build says

Creating cache default...
project/.sbt: found 2112 matching files            
Created cache
Job succeeded

I’m not getting any files appearing in /var/lib/gitlab-runner

what am I doing wrong?

oh, could it be that this is a different kind of cache? Maybe I need one of these

Assuming you want to see files locally in /var/lib/gitlab-runner, you can mount the volume as per Docker volume syntax:

volumes = ["/var/lib/gitlab-runner:/var/lib/gitlab-runner:rw"]

This works particularly well for package caches. :slight_smile:

1 Like