Open ghost opened 3 years ago
I don't think this should have been moved here, the Docker builder has perhaps the most expectation of caching, but a solution probably affects/would be for all, since "Packer builds Docker containers without the use of Dockerfiles. By not using Dockerfiles, Packer is able to provision containers with portable scripts or configuration management systems that are not tied to Docker in any way."
I got here by using mkaczanowski/packer-builder-arm and finding it painfully slow to work with/debug due to starting from scratch each time, and thought maybe I could use docker instead. But really I'd rather stick with builder, even if it was just as simple as a temporary --intermediate-caching
flag for development, whereby the image is cached between provisioners, so if one fails you can fix it and not have to re-run from scratch.
Yeah. Lack of caching is the primary reason I stopped using packer. I migrated back to Dockerfile and BuildKit approach.
any news on this or will this feature never added?
This issue was originally opened by @droopy4096 as hashicorp/packer#9758. It was migrated here as a result of the Packer plugin split. The original body of the issue is below.
Description
as per issue hashicorp/packer#1995 packer lacks the ability to use Docker cache (or any cache) for image building
Use Case(s)
At the moment I'm refactoring Microsoft Azure Pipeline Agent packer template to build container images (vs VM images) and finding the process to be overly tedious as build itself takes about 30min and with failures happening closer to the end of the build one has to spend extra 30min starting from start instead of recycling what already had been successfully built. There is no way to iterate fast without some sort of caching of all the "good" steps/layers.
Potential configuration
potentially having an option
--with-cache=XXX
save hashes for each step as tarballs (or other kind of blobs) under theXXX
directory, along with the metadata for that step. upon re-run packer should be able to determine existence of cache for each step and use that.Potential References