Building dynamic containers

Although Dockerfiles are a fairly powerful and flexible way of building containers, they are only static text files, and very often you will need to pass information into the container to tell it what to do. We might call such containers—whose configuration is flexible and based on data available at build time—dynamic containers.

Configuring containers with templates

One way to configure containers dynamically is to use Puppet to manage the Dockerfile as an EPP template (see Chapter 9, Managing files with templates), and interpolate the required data (which could come from Hiera, Facter, or directly from Puppet code).

Let's upgrade our previous Hello, world example to have Nginx serve any arbitrary text string, supplied ...

Get Puppet 5 Beginner's Guide - Third Edition 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.