Managing Docker with Puppet
Puppet can certainly install and manage the Docker service for you, just as it can any other software, but it can also do a lot more. It can download and run Docker images, build images from Dockerfiles, mount files and directories on the container, and manage Docker volumes and networks. We'll see how to do all these things in this chapter.
Installing Docker
Before we do anything else, we'll need to install Docker on our node (using Puppet, of course). The puppetlabs/docker_platform
module is ideal for this.
- If you've already installed and run the
r10k
module management tool, as shown in Chapter 7, Mastering modules, in the Using r10k section, the required module will already be installed. If not, run the following commands to install it:cd /etc/puppetlabs/code/environments/pbg sudo r10k puppetfile install
- Once the module is installed, all you need to do to install Docker on your node is to apply a manifest like the following (
docker_install.pp
)...