Forge Home


Module for installing and managing docker


542 latest version

Version information

  • 5.5.1 (latest)
released Jul 28th 2021
This version is compatible with:
  • Puppet Enterprise 2021.4.x, 2021.3.x, 2021.2.x, 2021.1.x, 2021.0.x, 2019.8.x, 2019.7.x, 2019.5.x, 2019.4.x, 2019.3.x, 2019.2.x, 2019.1.x, 2019.0.x, 2018.1.x, 2017.3.x, 2017.2.x, 2017.1.x, 2016.5.x, 2016.4.x
  • Puppet >= 3.4
  • , , , ,

Start using this module

  • r10k or Code Manager
  • Bolt
  • Manual installation
  • Direct download

Add this module to your Puppetfile:

mod 'utking-docker', '5.5.1'
Learn more about managing modules with a Puppetfile

Add this module to your Bolt project:

bolt module add utking-docker
Learn more about using this module with an existing project

Manually install this module globally with Puppet module tool:

puppet module install utking-docker --version 5.5.1

Direct download is not typically how you would use a Puppet module to manage your infrastructure, but you may want to download the module in order to inspect the code.

Tags: docker


utking/docker — version 5.5.1 Jul 28th 2021


Build Status

Puppet module for installing, configuring and managing Docker

This module was forked from and modified to work with the docker package from centos.


This module is currently only for RedHat clones 7.x:

  • Centos 7.0
  • OracleLinux 7.0
  • RedHat 7.0


The module includes a single class:

include 'docker'

By default the docker daemon will bind to a unix socket at /var/run/docker.sock. This can be changed, as well as binding to a tcp socket if required.

class { 'docker':
  bind_to    => 'tcp://',

If you want to track the latest version you can do so:

class { 'docker':
  version => 'latest',

In some cases dns resolution won't work well in the container unless you give a dns server to the docker daemon like this:

class { 'docker':
  dns => '',

The class contains lots of other options, please see the inline code documentation for the full options.


The next step is probably to install a docker image; for this we have a defined type which can be used like so:

docker::image { 'base': }

This is equivalent to running docker pull base. This is downloading a large binary so on first run can take a while. For that reason this define turns off the default 5 minute timeout for exec. Takes an optional parameter for installing image tags that is the equivalent to running docker pull -t="precise" ubuntu:

docker::image { 'ubuntu':
  image_tag => 'precise'

Note: images will only install if an image of that name does not already exist.

A images can also be added/build from a dockerfile with the docker_file property, this equivalent to running docker build -t ubuntu - < /tmp/Dockerfile

docker::image { 'ubuntu':
  docker_file => '/tmp/Dockerfile'

Images can also be added/build from a directory containing a dockerfile with the docker_dir property, this is equivalent to running docker build -t ubuntu /tmp/ubuntu_image

docker::image { 'ubuntu':
  docker_dir => '/tmp/ubuntu_image'

You can also remove images you no longer need with:

docker::image { 'base':
  ensure => 'absent'

docker::image { 'ubuntu':
  ensure    => 'absent',
  image_tag => 'precise'

If using hiera, there's a docker::images class you can configure, for example:

    image_tag: 'precise'

Private registries

By default images will be pushed and pulled from unless you've specified a server. If you have your own private registry without authentication, you can fully qualify your image name. If your private registry requires authentication you may configure a registry:

docker::registry { '':
  username => 'user',
  password => 'secret',
  email    => '',

You can logout of a registry if it is no longer required.

docker::registry { '':
  ensure => 'absent',

If using hiera, there's a docker::registry_auth class you can configure, for example:

    username: 'user1'
    password: 'secret'
    email: ''