Managing Docker images

Of course, it's very useful to be able to download and run public images from Docker Hub or other registries, but to unlock the real power of Docker we need to be able to build and manage our own images too.

Building images from Dockerfiles

As we saw in the previous examples, if you don't already have the specified container image on your system, Puppet's docker::image resource will pull it from Docker Hub for you and save it locally.

The docker::image resource is most useful, however, for actually building Docker images. This is usually done using a Dockerfile, so here is an example Dockerfile we can use to build an image (Dockerfile.hello):

FROM library/alpine:3.6 CMD /bin/sh -c "while true; do echo Hello, world; sleep 1; ...

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.