Book Image

Puppet for Containerization

By : Scott Coulton
Book Image

Puppet for Containerization

By: Scott Coulton

Overview of this book

This book teaches you how to take advantage of the new benefits of containerization systems such as Docker, Kubernetes, Docker Swarm, and Docker UCP, without losing the panoptical power of proper configuration management. You will learn how to integrate your containerized applications and modules with your Puppet workflow. You will also understand how to manage, monitor, and orchestrate hosts to keep deployed containers running seamlessly. With the help of this book, you can efficiently automate and document with containers, as a part of your system. The book will also cover use cases of deploying Puppet within a containerized environment.
Table of Contents (16 chapters)

Installing Docker


In this topic, we will put together all the configuration from our Vagrant repo and knowledge of the Puppet Forge to create the Docker environment.

Setting our manifests

The first thing that we need to do to install Docker is set our manifest to include the Docker class on our node. To do this, let's go to our Vagrant repo. In the repo, there is a file in the manifests directory called default.pp. We need to edit the file to include the Docker class node 'node-01' { include docker}. We can now save the file, and we are ready to run our environment.

The first step is to open our terminal and change to root of the Vagrant repo. Then, we need to enter the vagrant up command:

This will now provide us with our CentOS 7 box. Install r10k and then run Puppet and apply the Docker class. This will take about 4 minutes depending on your laptop and network connection. If the box was provisioned successfully, you will see the following output:

We can also verify that the Docker installation was successful by logging in to the box via SSH. We will do that with the vagrant ssh command. Once we are in, we will sudo up to root (sudo -i). Now, let's just check whether Docker is installed with the docker command.

You will see the following output on the terminal: