1
0
Fork 0
mirror of https://github.com/moby/moby.git synced 2022-11-09 12:21:53 -05:00
moby--moby/docs/sources/use/puppet.md
O.S.Tezer f87a97f7df Improve code/comment/output markings & display consistency
This PR aims to increase the consistency across the docs for
code blocks and code/comment/output markings.

Rule followed here is "what's visible on the screen should be reflected"

Issue:

 - Docs had various code blocks showing: comments, commands & outputs.
 - All three of these items were inconsistently marked.

Some examples as to how this PR aims to introduce improvements:

1. Removed `> ` from in front of the "outputs". Eg,
`    > REPOSITORY                 TAG       ID              CREATED` replaced with:
`    REPOSITORY                 TAG       ID              CREATED`.

2. Introduced `$` for commands. Eg,
`    sudo chkconfig docker on` replaced with:
`    $ sudo chkconfig docker on`

3. Comments:
`    > # ` replaced with:
`    # `.

> Please note:
> Due to a vast amount of items reviewed and changed for this PR, there
> might be some individually incorrect replacements OR patterns of incorrect
> replacements. This PR needs to be reviewed and if there is anything missing,
> it should be improved or amended.

Closes:
https://github.com/dotcloud/docker/issues/5286

Docker-DCO-1.1-Signed-off-by: O.S. Tezer <ostezer@gmail.com> (github: ostezer)
2014-05-01 17:52:01 +03:00

2.7 KiB

page_title: Puppet Usage page_description: Installating and using Puppet page_keywords: puppet, installation, usage, docker, documentation

Using Puppet

Note: Please note this is a community contributed installation path. The only official installation is using the Ubuntu installation path. This version may sometimes be out of date.

Requirements

To use this guide you'll need a working installation of Puppet from Puppetlabs .

The module also currently uses the official PPA so only works with Ubuntu.

Installation

The module is available on the Puppet Forge and can be installed using the built-in module tool.

$ puppet module install garethr/docker

It can also be found on GitHub if you would rather download the source.

Usage

The module provides a puppet class for installing Docker and two defined types for managing images and containers.

Installation

include 'docker'

Images

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 { 'ubuntu': }

This is equivalent to running:

$ docker pull ubuntu

Note that it will only be downloaded if an image of that name does not already exist. 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 the exec type. Note that you can also remove images you no longer need with:

docker::image { 'ubuntu':
  ensure => 'absent',
}

Containers

Now you have an image where you can run commands within a container managed by Docker.

docker::run { 'helloworld':
  image   => 'ubuntu',
  command => '/bin/sh -c "while true; do echo hello world; sleep 1; done"',
}

This is equivalent to running the following command, but under upstart:

$ docker run -d ubuntu /bin/sh -c "while true; do echo hello world; sleep 1; done"

Run also contains a number of optional parameters:

docker::run { 'helloworld':
  image        => 'ubuntu',
  command      => '/bin/sh -c "while true; do echo hello world; sleep 1; done"',
  ports        => ['4444', '4555'],
  volumes      => ['/var/lib/couchdb', '/var/log'],
  volumes_from => '6446ea52fbc9',
  memory_limit => 10485760, # bytes
  username     => 'example',
  hostname     => 'example.com',
  env          => ['FOO=BAR', 'FOO2=BAR2'],
  dns          => ['8.8.8.8', '8.8.4.4'],
}

Note that ports, env, dns and volumes can be set with either a single string or as above with an array of values.