There are 3 core use cases for integrating docker with Puppet or with another configuration management tool:
-
Using configuration management to provision the docker service on a host, so it's available to manage docker instances.
-
Adding or removing specific Docker instances, such as a containerized web server, on managed hosts.
-
Managing complicated or dynamic configurations within docker containers using configuration management tools (for example, Puppet agent) baked into the docker image.
You can use Puppet to solve two problems with large Docker workflows:
-
You have a Puppet code base and you're moving some of your services into containers. By sharing the same code across your infrastructure, regardless of whether or not it uses containers, you can cut down on duplication of effort, and take advantage of work you've already done.
-
You're building many images, but scaling Dockerfile involves either a complex hierarchy of images or copying and pasting snippets between many individual Dockerfiles. The image_build Puppet module lets you share common functionality using the familiar Puppet modules mechanism, and Puppet itself provides a rich domain-specific language for a declarative composition of images.
There are a lot of benefits with this approach:
-
Time saver: The puppet manifest that provisions a service is only required to run once, during image creation. The same image can be used in test, staging, production and development, lowering the diversity of environments.
-
Portability: the image can be used in any virtualization, in the cloud or on bare metal.
-
Rollbacks are always possible and are always simple: we can always spin up a previous image.