6 ms·
I took a detailed look at Docker's caching mechanism (actually: BuildKit) in this article https://www.augmentedmind.de/2023/11/19/advanced-buildkit-caching/ htt
by mshekow 2y ago
I took a detailed look at Docker's caching mechanism (actually: BuildKit) in this article https://www.augmentedmind.de/2023/11/19/advanced-buildkit-caching/ https://www.augmentedmind.de/2023/11/19/advanced-buildkit-ca...
There I also explain that IF you use a registry cache import/export, you should use the same registry to which you are also pushing your actual image, and use the "image-manifest=true" option (especially if you are targeting GHCR - on DockerHub "image-manifest=true" would not be necessary).
- remram 2y agoThanks, this is a very thorough explanation. Is there really no way to cache the 'cachemount' directories?
- mshekow 2y agoThe only option I know is to use network shares/disks, but you need to make sure that each share/disk is only used by one BuildKit process at a time.
- daulis 2y agoAfter years of lurking, I made an account to reply to this "image-manifest=true" was the magic parameter that I needed to make this work with a non-DockerHub registry (Artifactory). I spent a lot of time fighting this, and non-obvious error messages. Thank you!! We use a multi-stage build for a DevContainer environment, and the final image is quite large (for various reasons), so a better caching strategy really helps in our use case (smaller incremental image updates, smaller downloads for developers, less storage in the repository, etc)