Impressions of Packer

Clouds in a blue sky

One of the tools I've been using lately is Packer, a machine building tool. It builds machine images for VirtualBox, VMWare Fusion, OpenStack, AWS, DigitalOcean, Docker, and more,

It can bootstrap from an ISO or an existing image (for some cloud providers and from desktop virtual machine images). You can use shell scripts, Chef, Puppet and other provisioning tools.

Images seem like old school. After all, everything is being Dockerized. Containerized applications are pretty amazing and Docker is pretty good in concept. Like git, the raw speed and workflow make it leap over virtual machines. Performance (whether that be the raw processing power or the quickness of the workflow) enables faster feedback which developers always crave. DockerHub is also important.

While Docker is hyped, "raw" machine images are still important. You still need to bootstrap your infrastructure's base machines. I can have a machine image that runs Docker but there's still many things that need to be setup on the Docker host. Firewall rules, service discovery, monitoring tools, and so forth are still required outside a container on the host machine.

Building raw images using Packer makes the process repeatable while also making the image available on different possible platforms. There may be a few minor tweaks that need to be made for each platform but in general, I've been able to get a single Packer config working on multiple platforms.

I recommend all your software's system requirements, caching systems, system updates, Docker, etc. to be setup using Packer. Packer allows you to control which version of the system requirements you really want to use.

Once you have Packer build your image, then you can use Vagrant, Terraform, or other infrastructure provisioning tools to do "the final provisioning leg". The final leg would involve deploying the actual code and doing the final configurations for your services on that machine.

Whether it be building "simpler" and more straightforward images for demos/tests in a CICD process or creating the building blocks of a multi-node infrastructure, Packer is a good tool for repeatable machine image builds.