Applying the VirtualBox builder
VirtualBox might not be considered a production hypervisor, but it is actually very helpful when learning Packer on your own. VirtualBox works on most common operating systems and gives you the option to connect and troubleshoot a VM during an image build. Note that the builders that support VirtualBox offer a headless option, meaning you will not launch VMs in a GUI during a build. This is handy if you are working remotely via SSH or using automation.
A caveat to the VirtualBox builder is lack of access to TTY from your Packer session. This means the machine’s text output won’t directly show up in Packer output. Provisioners executing over SSH have the handy ssh_pty
option, which allows you to capture SSH output. For the rest, you should probably use headless = "false"
, which is the default and lets you view the VM in VirtualBox. Later, we will cover other builders such as QEMU, which can actually output all of a VM’...