Gitlab-runner in a kubernetes cluster doesn't use image cache

I’m wanting to cache base images, like, ruby, node, postgres, etc – these images don’t change much, and it kind of seems like a shame to have to download them all the time.

My setup:

  • repo
  • GKE Kubernetes Cluster
  • Auto DevOps (Slightly Modified)
  • Custom App Helm Chart
  • Custom gitlab-runner helm chart (but based off the official one)

I’m not wanting to use a container registry (as other guides/threads have suggested for the app image (though I will end up using one – this thread is about base images))

my gitlab-runner chart:
my app chart:
my .gitlab-ci.yml:

I’ve tried mapping the docker.sock file, but it seems like I can only use docker inside a pod if I enable the docker:dind service, which doesn’t use the docker.sock, but uses the tcp socket for the DOCKER_HOST.
I’ve also tried mapping /var/lib/docker entirely, which I know would cause some concurrency issues, but that didn’t work either.

My test is simple.

$ docker pull ruby
Using default tag: latest
latest: Pulling from library/ruby
85b1f47fba49: Already exists 
ba6bd283713a: Pull complete 
817c8cd48a09: Pull complete 
47cc0ed96dc3: Pull complete 
00233accc944: Pull complete 
b4f747320dba: Pull complete 
5b0e9451d648: Pull complete 
Digest: sha256:3514c324317fd63aa5e27c39592a9e1b5d94f014c49c3d58cb536a42ccf17d28
Status: Downloaded newer image for ruby:latest

but the second time, it should be:

$ docker pull ruby
Using default tag: latest
latest: Pulling from library/ruby
Digest: sha256:3514c324317fd63aa5e27c39592a9e1b5d94f014c49c3d58cb536a42ccf17d28
Status: Image is up to date for ruby:latest

I’ve opened an issue on the gitlab-runner here:

but there has been no interaction.

any ideas?