Running HashiCorp Packer?

Packer image builds timing out or failing? We unstick it.

Packer is a workhorse until a builder refuses to spin up, a provisioner hangs waiting on SSH that never arrives, or an HCL2 migration leaves a build that works on one branch and fails on another. We walk the builder config, the provisioner scripts and the resulting images until the pipeline produces clean, versioned artifacts on schedule.

  • Since 2015Fixing technology
  • FreeEstimates
  • US teamReal engineers

packer-build.log

still failing

What it is

Packer at a glance

Packer is HashiCorp's tool for building identical machine images from a single source configuration across clouds, hypervisors and container runtimes. Mitchell Hashimoto released the first version in 2013, and Packer joined the broader HashiCorp suite alongside Terraform, Vagrant and Consul.

A Packer build pairs a source, which is a builder such as amazon-ebs, azure-arm, googlecompute, qemu or docker, with one or more provisioners that install software and configure the resulting image. The HCL2 format replaced the older JSON templates and is now the recommended authoring surface. Packer still ships images that Terraform and other tooling can consume, which is where its value usually lands.

Type
Machine image builder for multiple clouds and hypervisors
First released
2013 by Mitchell Hashimoto
License
Business Source License, source available with usage limits, formerly MPL 2.0
Maintained by
HashiCorp and open source contributors
Typically used for
AMI pipelines, Azure and GCP image bakes, VMware and KVM templates, container image builds, golden image strategies

The honest version

Packer pros and cons

No technology is all upside. This is where Packer earns its place and where it tends to cause trouble.

Where Packer is strong

  • One template, many targetsThe same Packer config produces an AMI, an Azure managed image and a GCP image, so a team that runs multi cloud does not maintain three image pipelines.
  • Deterministic image contentsBaking software into an image at build time rather than at boot gives you faster, more predictable launches and fewer runtime config drift surprises.
  • Fits beside TerraformPacker builds the AMI, Terraform consumes the AMI ID through data sources or variables, so the two tools compose naturally for infrastructure teams already on HashiCorp.
  • Broad builder listAWS, Azure, GCP, VMware, Hyper-V, QEMU, Docker, LXC and Proxmox builders all live in one tool, which is useful for hybrid environments.
  • Works with existing provisionersShell, Ansible, Chef, Puppet and PowerShell DSC provisioners are supported, so you can reuse what you already have rather than rewriting config management.
  • Image versioning is first classHCP Packer and the manifest post processor give you a channel of named versions, so Terraform can pin to a known good image rather than the latest tag.

Where Packer bites

  • SSH and WinRM timeouts are the usual pain pointMost build failures are the provisioner never managing to connect, usually because of a security group, a user data script that never finished, or a Windows WinRM config that is subtly wrong.
  • Build times are longA full image bake can take 10 to 30 minutes depending on provisioning, which tightens the feedback loop on template changes. Local test cycles matter.
  • HCL2 migration from JSON was disruptiveThe old JSON templates still work in some versions and not others, and real codebases often have a mix that nobody has had time to finish porting.
  • License change from MPL 2.0 to BSLHashiCorp relicensed Packer under the Business Source License in 2023, which created real compliance questions for some organizations and spawned forks.
  • Error messages lean on the underlying cloudA Packer error often wraps an AWS or Azure API message, and debugging means switching between Packer logs and the cloud console rather than reading one stream.
  • Provisioner choice becomes a taxEvery image added increases the surface the provisioner scripts have to keep green. Hardening, patching and base image refreshes are all ongoing work.

Sound familiar?

Common Packer problems we fix

The Packer problems that bring people to us, and what you have once each one is fixed.

Error: Timeout waiting for SSH

Packer never manages to SSH into the build instance

A security group without the Packer runner CIDR, a user data script that fails before sshd starts, or a VPC subnet with no route to the public internet for the bootstrap.

Provisioner connects on first try

OSProvisioningTimedOut on Azure

An Azure image build times out during OS provisioning

An azure-arm build where the VM agent never reports ready, usually because of a base image that no longer boots cleanly or a custom data script that hangs.

Azure builds complete on schedule

deprecated JSON template warning

An HCL2 migration is only half done

A repo with both JSON and HCL2 templates, where the two paths have drifted and only one branch builds. The port is finite but needs to be finished.

One template language, both paths work

ansible provisioner: ssh connect failed

Ansible cannot reach the build host

A provisioner trying to run against the public IP when the build host is in a private subnet, or an SSH key that Packer created but Ansible cannot find in its known_hosts.

Ansible runs against the right host

googlecompute: quotaExceeded

A cloud quota is blocking the build

Concurrent Packer builds hitting a VM count or CPU quota, often because multiple branches kicked a build at the same time and nothing serializes them.

Builds respect quota and schedule

InvalidAMIID.NotFound

A source AMI is no longer available

A base image that was deprecated by the publisher, or a region where the AMI was never shared, so Packer cannot start the builder at all.

Base images refreshed and tracked

winrm unencrypted http

WinRM over plain HTTP is in use

A Windows build that uses WinRM on port 5985 without TLS, which works but leaves credentials visible on the wire and fails modern policy scans.

WinRM hardened over HTTPS

manifest output file already exists

The manifest post processor keeps clashing with itself

A pipeline that runs Packer without clearing the manifest output, so each build fails to write the file. Easy to miss until the pipeline needs the manifest downstream.

Manifest written cleanly per build

What we do

Packer help, from timeouts to golden images

We take on a single failing build, or design the whole image pipeline from scratch.

Rescue
A Packer template that will not build, a provisioner that hangs, or a base image that disappeared from the publisher. We stabilize the pipeline first.
HCL2 migration
Porting JSON templates to HCL2, keeping variables and provisioner behavior identical, with tests that prove the resulting image is byte for byte equivalent.
Multi cloud images
AMI, Azure managed image and GCP image built from a single source so platform teams stop maintaining three near identical configs.
Golden image strategy
Base image selection, patching cadence, versioning with HCP Packer and Terraform integration that pins to known good versions.
Hardening
CIS benchmarks, SSH and WinRM configuration, secret handling at build time and provenance so compliance scans stop raising surprises.
Managed Tech
Scheduled image refreshes, upstream base image tracking, Packer upgrades and an engineer on call when a cloud API change breaks a Friday build.

How it works

From first message to fixed

  1. Look Free estimate

    Tell us what's going wrong. We look at it, then tell you plainly what's wrong and what it will cost.

  2. Fix

    We fix the cause, not the symptom. If something is down, getting it back up comes first.

  3. Harden

    Backups, monitoring, updates and access, so the same problem can't quietly come back.

  4. Hand back or stay on

    You get a plain-language write-up. Or we stay on for hosting, upkeep and new work.

Often found together

Running Packer alongside something else?

We work on the whole stack, so the problem can be wherever it actually is.

Questions

Packer questions

Something else? Call+1 737 727 7327

Why does Packer always time out waiting for SSH?

Nine times out of ten the build instance is actually booting fine and Packer just cannot reach it. The usual culprits are a security group that blocks the Packer runner, a subnet with no public IP and no NAT path for the bootstrap, or a user data script that is still running after the SSH timeout expires. We trace it from the cloud console on the build instance side rather than only reading Packer's own log.

Should we still use JSON templates or move to HCL2?

Move to HCL2. The JSON format still works in many Packer versions but new features and much of the current documentation assume HCL2. The migration is mechanical for straightforward templates and worth doing in one pass, because a half migrated repo has two sources of truth and both of them lie to you eventually.

How does Packer fit with Terraform?

Packer builds the image; Terraform consumes it. The usual pattern is Packer produces an AMI or image with a known tag or HCP Packer channel, and a Terraform data source looks that image up at plan time. Keeping the build pipeline and the apply pipeline separate lets each run on its own cadence and keeps roll forward and roll back legible.

Did the Packer license change affect our builds?

In practice, most users can keep running Packer under the Business Source License for internal use. The compliance question comes up for vendors who ship Packer as part of a product or offering, where the BSL has conditions. We can read your specific case and tell you plainly whether you need to switch to a fork or stay on upstream.

How do we handle long provisioning without inflating build time?

Split the image into layers. A base image that is refreshed weekly with OS patches and heavy dependencies, and a thin app image that builds on top in a few minutes. Packer supports chaining builds with manifest handoff, and Terraform can consume either layer. The result is faster iteration on the app layer without rebuilding the world.

How much does Packer help cost?

Our estimates do not cost a thing. Share the failing build log or a note on the pipeline, and a price lands before anyone touches the template.

Free estimate

Packer builds not landing?

Send over the build log or a sketch of the pipeline, and an image engineer gets back with a plan and a price.

  • No charge to find out what it will take
  • If it's urgent, say so

Replies come from a person. By sending, you authorize us to email you back. No marketing.