Packer (software)
Developer(s) | Mitchell Hashimoto |
---|---|
Development status | Active |
Written in | Go |
Operating system |
Microsoft Windows Mac OS X Linux |
Available in | English |
License | Mozilla Public License Version 2.0 |
Website |
www |
Packer is free and open-source software for creating identical machine images or containers for multiple platforms from a single source configuration. It is used primarily to automate the creation of machine images which have a particular operating system and pre-installed software in it. It was written by Mitchell Hashimoto and became one of the products in his company Hashicorp's software toolkits as open-source proprietary-managed software. Packer can be used with Vagrant or independently. Packer can also be used with configuration management tools such as Chef and Puppet. However, it does not serve as a substitute for these tools.[1]
Packer is written in Go programming language.[2]
History
Packer was first introduced by Hashicorp on June 28, 2013.[3] In April 2015, Hashicorp announced Packer integration with Atlas. This allowed remotely managing automated packer builds. After two months, in June 2015, Hashicorp release 0.8 version of Packer. This was the largest release of Packer in terms of number of features. Packer version 0.8 facilitated creating Windows images on AWS, and obviated the need of having SSH server installed.[4] Instead, WinRM support was introduced.
Applications
Packer can act as a component in a continuous integration workflow. The images that Packer creates can easily be turned into Vagrant boxes. Any updates to an image become available to the users through Vagrant cloud (a cloud service also from Hashicorp) or Atlas. The users can then update their copies of the image by running certain Vagrant commands. The Hashicorp Terraform system deployment product can use Packer as a container, and the Hashicorp Atlas workflow tool includes Vagrant, Packer, Serf, and Terraform as component tools.
Chef can use Packer for container creation via the Bento toolkit.[5][6] As Packer makes it possible to produce identical images on multiple platforms, it is possible to have testing, development and production in different platforms keeping the same machine image.[7]
Usage
Packer takes a configuration template and produces machine image as per instructions in the template. Templates are usually JSON files and can contain following sections:[8]
- builders
This section holds an array of objects that Packer should use to generate different machine images. Each builder object generates an image for a specific platform. By default, Packer comes with builders for several platforms as mentioned below in platform support.
- description
Description of what the template does.
- min_packer_version
Minimum Packer version required to parse the template to ensure that proper versions of Packer are used with the template. Packer supports backward compatibility using the fix command.
- post-processors
Defines the various post-processing steps to take with the built images. For instance, the built image can be converted to Vagrant box format.
- provisioners
To install additional software beyond the base operating system software. Typical example of provisioners can be Shell.
- variables
Defines user variables contained in the template. These variables contain values passed from command line and can be used multiple times in a single template.
While other fields are optional, builders is a mandatory section in a template.
Basic commands
Below commands are available as of packer version 0.8.6.[9]
- Build
This command will build the image according to the template provided.
- Fix
This command is used to update old packer templates to new format. Typical scenario where it can be used is when newer version of packer expects different template format than the previous version of the software.
- Inspect
This command lists out the basic components in the template such as variables, builders and post-processors, without going into details.
- Push
This command is used to push the packer images to remote build repository. Currently the only remote build service supported is Atlas by Hashicorp.
- Validate
This command is used to ensure the template has correct syntax. It can be used before building image to catch early issues in template.
- Version
This command prints the packer version.
Packer also supports custom command development which allows one to add new commands to the Packer.[10]
Platform support
Packer can create images for multiple platforms including Amazon EC2, DigitalOcean, Docker, Google Compute Engine, OpenStack, Parallels, QEMU, VirtualBox, VMware(OVF) and is extensible to more platforms through plugins, according to platform support list.[11]
Operating system support
Packer can be installed on almost all major operating systems and is distributed as a binary package for all supported platforms and architectures. Binaries can be downloaded for 32 bit and 64 bit versions of FreeBSD, Linux, Mac OS X, OpenBSD and Windows.[12]
Similar software
Veewee is also an open source tool as Packer and also used to create machine images. Packer also supports converting of Veewee template to equivalent Packer template so as to make it simple for existing Veewee users to use Packer.[13]
See also
References
- ↑ "Packer introduction". Retrieved 15 September 2015.
- ↑ "Four years of Go - The Go Blog". Retrieved 16 September 2015.
- ↑ "Mithell Hashimoto Blog". Retrieved 25 September 2015.
- ↑ "Packer Blog". Retrieved 25 September 2015.
- ↑ "Chef for Containers". Retrieved April 24, 2014.
- ↑ "Bento". Retrieved April 24, 2015.
- ↑ "Why Use Packer?". Retrieved 15 September 2015.
- ↑ "Packer Templates Introduction". Retrieved 16 September 2015.
- ↑ "Packer Command Line Documentation". Retrieved 25 September 2015.
- ↑ "Custom Command Development - Packer by Hashicorp". Retrieved 17 September 2015.
- ↑ "Packer Platform Support". Retrieved 15 September 2015.
- ↑ "Packer Downloads". Retrieved 15 September 2015.
- ↑ "Convert Veewee Definitions to Packer Templates". Retrieved 15 September 2015.