5 Docker and Packer

In the last chapter we saw how to use provisioners to customize our images during the build process. In this chapter, we’re going to continue to explore building and provisioning images with Packer. And we’re going to look at one of Packer’s most interesting and complex use cases: building Docker images.

To build Docker images, Packer uses the Docker daemon to run containers, runs provisioners on those containers, then can commit Docker images locally or push them up to the Docker Hub. But, interestingly, Packer doesn’t use Dockerfiles to build images. Instead Packer uses the same provisioners we saw in Chapter 3 to build images. This allows us to create a consistent mental model for all our images, across all platforms. ...

Get The Packer Book now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.