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; done" LABEL org.label-schema.vendor="Bitfield Consulting" \ org.label-schema.url="http://bitfieldconsulting.com" \ org.label-schema.name="Hello World" \ org.label-schema.version="1...