Caching images from external registries

Hi, we use in our project, external images built on our own build server. In our config.yml we have them like open-build-service/config.yml at master · openSUSE/open-build-service · GitHub

The issue is that would be nice if we could cache those images. I see that after enabling docker layer caching it somehow works, but not always. Without caching, beside the fact it affects our “spin up environment”, it sounds like a huge waste of energy downloading the same files, over and over again. So there is a way to cache those images, after it get downloaded?

Hi @vpereira ,

I understand that from the linked project, you are using your own custom images, such as egistry.opensuse.org/obs/server/unstable/containers/containers/openbuildservice/mariadb:latest, hosted on your own Docker registry, registry.opensuse.org.

In terms of caching these images so that jobs using these images run faster, Docker Layer Caching (DLC) would unfortunately not be related since DLC is actually caching layers of a Docker build (i.e., effective for when building images inside a CircleCI job).

The trade-off of using a custom or less-frequently-used image is that the machine running your Docker jobs would likely need to download this image. On the other hand, the reason why CircleCI’s convenience images are recommended is so that there is a higher change a previous Docker job was using the same image (i.e., the machine has this image available), so you job would not require a re-download of this image to spin up.

However, in terms of what can we do then to improve the spin-up times, I think you may be interested in a similar discussion here: Can I cache our custom docker image? - #3 by gmemstr

In general, if there is any way we can reduce the total size of the custom images, that would help improve the spin-up times. I think this is a good strategy since it applies well, cache or no cache!
Another idea is to ensure lower latency in data transfer between your Docker registry and the CircleCI machines, such as confining them to the same region.
There is an ongoing Canny feature request about this so you may also be interested to give your vote!

hey @kelvintaywl, i will look into that, thank you for your answer!

1 Like

No problem, @vpereira , hope you have found a resolution for your issue!

If so, I’d love to hear it if you can share it here too!
I believe this would be helpful for anyone else stumbling into this post :slight_smile: