Packer: Build from cache

Created on 20 Mar 2015  ยท  7Comments  ยท  Source: hashicorp/packer

I'm pretty surprised to not be able to find anyone else wanting for this, but maybe i'm missing something here...

I _desperately_ want to be able to start/re-start a build from cache, similar to how docker works. Spending 3-4 minutes to spin up and configure a VM, only to have a script you are wrestling with to fail makes me want to burn things. This the build cache feature in Docker has unlocked a lot of different concepts/techniques/projects for me, simply by saving time / frustration... this is invaluable for developers who are not strong admins.

Stuff like building from a vagrant box is a huge leg up in that i wouldn't have to boot up / configure a new VM w/ each build, but i'd still be left waiting while the rest of my scripts are running. If there are any tricks, tips or techniques for me to ease this pain i'm all ears, but to me its a pretty big slam-dunk if you guys can figure out a way to allow me to quickly iterate over my installation processes... honestly not sure if its even possible.

question

Most helpful comment

@mwhooker Why is this issue closed? The lack of layer caching makes Docker builds from Packer templates much, much slower than those from a Dockerfile. Is there any way to fix this?

All 7 comments

this feature already available for example for qemu builder.

@derek-adair I've found the best option is to build in stages. Once to install the OS, then keep the input artifact and use that in another stage. Once you've vetted your entire script chain you can easily put them into a loop or single provisioning pass.

Personally at my current employer I'm building a base install, then saving that as a tar.gz with the compress post-processor then using a script to unpack the tar.gz and use the VM contained within an input file into another Packer template.

I'd be interested in this feature as well, was surprised to see this not in use. @derek-adair, did you patch your local install ?

Actually I switched my workflow to use Docker, primarily, for this issue (rapid iterations / developmnt / caching helps newbie admins like myself). Its just faster for me.

I think the strategy advocating by @dragon788 is absolutely a valid option, however it basically amounts to manual caching, which doesn't help me personally when trying X/Y/Z to get a thing to work. If you are a strong admin I feel like this is a more viable workflow, but for me, it takes sometimes 10-20 tries. Adding potentially minutes to each attempt, depending on what type of manual caches you have.

That being said if you can handle it, the packer option isn't subject to layer limitations, and a couple other drawbacks that i can't think of off the top of my head.

@mwhooker Why is this issue closed? The lack of layer caching makes Docker builds from Packer templates much, much slower than those from a Dockerfile. Is there any way to fix this?

@mwhooker Why is this issue closed? The lack of layer caching makes Docker builds from Packer templates much, much slower than those from a Dockerfile. Is there any way to fix this?

I second this, if there was a way of allowing provisioners to cache then that would be awesome

I'm going to lock this issue because it has been closed for _30 days_ โณ. This helps our maintainers find and focus on the active issues.

If you have found a problem that seems similar to this, please open a new issue and complete the issue template so we can capture all the details necessary to investigate further.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

paulcdejean picture paulcdejean  ยท  3Comments

frezbo picture frezbo  ยท  3Comments

shantanugadgil picture shantanugadgil  ยท  3Comments

Nikoos picture Nikoos  ยท  3Comments

mwhooker picture mwhooker  ยท  3Comments