github.com/portworx/docker@v1.12.1/docs/admin/puppet.md (about) 1 <!--[metadata]> 2 +++ 3 aliases = ["/engine/articles/puppet/"] 4 title = "Using Puppet" 5 description = "Installing and using Puppet" 6 keywords = ["puppet, installation, usage, docker, documentation"] 7 [menu.main] 8 parent = "engine_admin" 9 weight="12" 10 +++ 11 <![end-metadata]--> 12 13 # Using Puppet 14 15 > *Note:* Please note this is a community contributed installation path. The 16 > only `official` installation is using the 17 > [*Ubuntu*](../installation/linux/ubuntulinux.md) installation 18 > path. This version may sometimes be out of date. 19 20 ## Requirements 21 22 To use this guide you'll need a working installation of Puppet from 23 [Puppet Labs](https://puppetlabs.com) . 24 25 The module also currently uses the official PPA so only works with 26 Ubuntu. 27 28 ## Installation 29 30 The module is available on the [Puppet 31 Forge](https://forge.puppetlabs.com/garethr/docker/) and can be 32 installed using the built-in module tool. 33 34 $ puppet module install garethr/docker 35 36 It can also be found on 37 [GitHub](https://github.com/garethr/garethr-docker) if you would rather 38 download the source. 39 40 ## Usage 41 42 The module provides a puppet class for installing Docker and two defined 43 types for managing images and containers. 44 45 ### Installation 46 47 include 'docker' 48 49 ### Images 50 51 The next step is probably to install a Docker image. For this, we have a 52 defined type which can be used like so: 53 54 docker::image { 'ubuntu': } 55 56 This is equivalent to running: 57 58 $ docker pull ubuntu 59 60 Note that it will only be downloaded if an image of that name does not 61 already exist. This is downloading a large binary so on first run can 62 take a while. For that reason this define turns off the default 5 minute 63 timeout for the exec type. Note that you can also remove images you no 64 longer need with: 65 66 docker::image { 'ubuntu': 67 ensure => 'absent', 68 } 69 70 ### Containers 71 72 Now you have an image where you can run commands within a container 73 managed by Docker. 74 75 docker::run { 'helloworld': 76 image => 'ubuntu', 77 command => '/bin/sh -c "while true; do echo hello world; sleep 1; done"', 78 } 79 80 This is equivalent to running the following command, but under upstart: 81 82 $ docker run -d ubuntu /bin/sh -c "while true; do echo hello world; sleep 1; done" 83 84 Run also contains a number of optional parameters: 85 86 docker::run { 'helloworld': 87 image => 'ubuntu', 88 command => '/bin/sh -c "while true; do echo hello world; sleep 1; done"', 89 ports => ['4444', '4555'], 90 volumes => ['/var/lib/couchdb', '/var/log'], 91 volumes_from => '6446ea52fbc9', 92 memory_limit => 10485760, # bytes 93 username => 'example', 94 hostname => 'example.com', 95 env => ['FOO=BAR', 'FOO2=BAR2'], 96 dns => ['8.8.8.8', '8.8.4.4'], 97 } 98 99 > *Note:* 100 > The `ports`, `env`, `dns` and `volumes` attributes can be set with either a single 101 > string or as above with an array of values.