Forge Home

g_docker

pdk
Manages Docker containers, its volumes and configs.

5,437 downloads

834 latest version

5.0 quality score

Version information

  • 1.7.0 (latest)
  • 1.6.0
  • 1.5.1
  • 1.5.0
  • 1.4.0
  • 1.3.0
  • 1.2.0
  • 1.1.1
  • 1.1.0
released May 14th 2020
This version is compatible with:
  • Puppet Enterprise 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, 2016.4.x
  • Puppet >= 4.10.0 < 7.0.0
  • CentOS
    ,
    OracleLinux
    ,
    RedHat
    ,
    Scientific
    ,
    Debian
    ,
    Ubuntu
    ,
    Fedora

Start using this module

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

Add this module to your Puppetfile:

mod 'glorpen-g_docker', '1.7.0'
Learn more about managing modules with a Puppetfile

Add this module to your Bolt project:

bolt module add glorpen-g_docker
Learn more about using this module with an existing project

Manually install this module globally with Puppet module tool:

puppet module install glorpen-g_docker --version 1.7.0

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.

Download

Documentation

glorpen/g_docker — version 1.7.0 May 14th 2020

g-docker

Configures Docker daemon and allows running containers as system services.

The main target of this module is running containerized apps as system services when not using cluster supervisor (Docker Swarm, Kubernetes, ...).

Helpful features

  • containers can be reloaded upon managed configuration changes - no restarting
  • persistent container data stored on managed LVM volumes
  • binding specific folders to container
  • manageable firewall - automatic rules created by Docker are accounted for by Puppet, you can safely purge unmanaged firewall rules
  • pluggable storage and firewall modules

Usage

Setup

Remember to enable and configure choosen firewall and storage driver.

include ::g_docker::firewall::native
include ::g_docker::storage::overlay2

class { ::g_docker: }

Creating containers:

Hiera:

g_docker::instances:
  example:
    image: example:latest
    env:
      MY_ENV: "some env"
    volumes:
      data:
        size: 30G
        binds:
          home:
            path: /data
            readonly: false
            user: 1000
            group: 1000
            mode: a=rx,u+w

Runtime configs and reloading

You can create small configuration files with puppet and mount it inside containers.

Hiera:

g_docker::instances:
  example:
    # ...
    runtime_configs:
      pupppetizer:
        target: /var/opt/puppetizer/hiera
        configs:
          "runtime.yaml":
            reload: true
            source: puppet:///modules/profile/proxy.yaml

or Puppet DSL:

g_docker::run { 'example-1':
  ensure => present,
  image => 'example:latest',
  runtime_configs => {
    'puppetizer' => {
      'target' => '/var/opt/puppetizer/hiera',
      'configs' => {
        'runtime.yaml' => {
          'reload' => true,
          'source' => 'puppet:///modules/profile/proxy.yaml',
        },
      },
    },
  },
}

Following example works identically to previous one:

g_docker::run { 'example-1':
  ensure => present,
  image => 'example:latest',
  runtime_configs => {
    'puppetizer' => {
      'target' => '/var/opt/puppetizer/hiera',
      },
    },
  },
}

g_docker::runtime_config::config { 'example':
  container => 'example-1',
  group     => 'puppetizer',
  filename  => 'runtime.yaml',
  reload    => true,
  source    => 'puppet:///modules/profile/proxy.yaml',
}