Pull through cache registry getting ignored when running 'docker build' but works on 'docker pull'

Hello y’all,
I am trying to setup a docker pull-through cache. I have configured my /etc/docker/daemon.json
Here are the contents:

{
  "registry-mirrors": ["http://cache-vm-ip:6000"],
  "debug": true
}

And I can see the Registry mirror when running docker info:

docker info | grep -i 'Registry' -A 5
 Registry Mirrors:
  http://cache-vm-ip:6000/
 Live Restore Enabled: false

When I run something like docker pull node:22, I can see the logs in my registry mirror that the traffic is going through the cache but when I try to build a Dockerfile with the same image, the traffic goes directly to Dockerhub.

FROM node:22

Have not been able to find anything and not sure where I am going wrong. Any help would be appreciated!

I am running Debian 11 on a GCP VM but I am trying to make the same setup on a Gitlab runner system and facing the same issues.

Thanks in advance :slight_smile:

What is the docker version? I’m not entirely sure how it should work, but recent Docker versions use buildkit for building images, so maybe it requires additional configuration.

I also found this

Hi,
The docker version is 24.0.6.

You are right, I found out that I need to further configure Buildkit for registry mirror configuration.

I’ll try that and update here. Thanks!