-
Book Overview & Buying
-
Table Of Contents
HashiCorp Packer in Production
By :
Docker, LXC, LXD, and Podman are supported via Packer plugins. At first, it may seem counter-intuitive to use Packer for building containers. Docker does a fairly good job of making container images. The nice part about adding a container builder to your template is that it allows you to package your applications and config in containers at the same time as cloud or VM images. In addition to the builder, the Docker plugin has some very helpful postprocessors to manage the container registry lifecycle:
docker importdocker pushdocker savedocker tagYou may have Packer build and push containers to your private registry as part of your automation. You may also automate tagging with Packer’s variables or useful HCL date/time functions. Here is an example:
source "docker" "base-docker" {
image = "ubuntu"
commit = true
changes = [
...