|
@@ -25,9 +25,9 @@ Installation
|
|
The module is available on the `Puppet Forge <https://forge.puppetlabs.com/garethr/docker/>`_
|
|
The module is available on the `Puppet Forge <https://forge.puppetlabs.com/garethr/docker/>`_
|
|
and can be installed using the built-in module tool.
|
|
and can be installed using the built-in module tool.
|
|
|
|
|
|
- .. code-block:: bash
|
|
|
|
|
|
+.. code-block:: bash
|
|
|
|
|
|
- puppet module install garethr/docker
|
|
|
|
|
|
+ puppet module install garethr/docker
|
|
|
|
|
|
It can also be found on `GitHub <https://www.github.com/garethr/garethr-docker>`_
|
|
It can also be found on `GitHub <https://www.github.com/garethr/garethr-docker>`_
|
|
if you would rather download the source.
|
|
if you would rather download the source.
|
|
@@ -41,9 +41,9 @@ for managing images and containers.
|
|
Installation
|
|
Installation
|
|
~~~~~~~~~~~~
|
|
~~~~~~~~~~~~
|
|
|
|
|
|
- .. code-block:: ruby
|
|
|
|
|
|
+.. code-block:: ruby
|
|
|
|
|
|
- include 'docker'
|
|
|
|
|
|
+ include 'docker'
|
|
|
|
|
|
Images
|
|
Images
|
|
~~~~~~
|
|
~~~~~~
|
|
@@ -51,26 +51,26 @@ Images
|
|
The next step is probably to install a docker image, for this we have a
|
|
The next step is probably to install a docker image, for this we have a
|
|
defined type which can be used like so:
|
|
defined type which can be used like so:
|
|
|
|
|
|
- .. code-block:: ruby
|
|
|
|
|
|
+.. code-block:: ruby
|
|
|
|
|
|
- docker::image { 'base': }
|
|
|
|
|
|
+ docker::image { 'base': }
|
|
|
|
|
|
This is equivalent to running:
|
|
This is equivalent to running:
|
|
|
|
|
|
- .. code-block:: bash
|
|
|
|
|
|
+.. code-block:: bash
|
|
|
|
|
|
- docker pull base
|
|
|
|
|
|
+ docker pull base
|
|
|
|
|
|
Note that it will only if the image of that name does not already exist.
|
|
Note that it will only if the image of that name does not already exist.
|
|
This is downloading a large binary so on first run can take a while.
|
|
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 that reason this define turns off the default 5 minute timeout
|
|
for exec. Note that you can also remove images you no longer need with:
|
|
for exec. Note that you can also remove images you no longer need with:
|
|
|
|
|
|
- .. code-block:: ruby
|
|
|
|
|
|
+.. code-block:: ruby
|
|
|
|
|
|
- docker::image { 'base':
|
|
|
|
- ensure => 'absent',
|
|
|
|
- }
|
|
|
|
|
|
+ docker::image { 'base':
|
|
|
|
+ ensure => 'absent',
|
|
|
|
+ }
|
|
|
|
|
|
Containers
|
|
Containers
|
|
~~~~~~~~~~
|
|
~~~~~~~~~~
|
|
@@ -78,35 +78,35 @@ Containers
|
|
Now you have an image you can run commands within a container managed by
|
|
Now you have an image you can run commands within a container managed by
|
|
docker.
|
|
docker.
|
|
|
|
|
|
- .. code-block:: ruby
|
|
|
|
|
|
+.. code-block:: ruby
|
|
|
|
|
|
- docker::run { 'helloworld':
|
|
|
|
- image => 'base',
|
|
|
|
- command => '/bin/sh -c "while true; do echo hello world; sleep 1; done"',
|
|
|
|
- }
|
|
|
|
|
|
+ docker::run { 'helloworld':
|
|
|
|
+ image => 'base',
|
|
|
|
+ command => '/bin/sh -c "while true; do echo hello world; sleep 1; done"',
|
|
|
|
+ }
|
|
|
|
|
|
This is equivalent to running the following command, but under upstart:
|
|
This is equivalent to running the following command, but under upstart:
|
|
|
|
|
|
- .. code-block:: bash
|
|
|
|
|
|
+.. code-block:: bash
|
|
|
|
|
|
- docker run -d base /bin/sh -c "while true; do echo hello world; sleep 1; done"
|
|
|
|
|
|
+ docker run -d base /bin/sh -c "while true; do echo hello world; sleep 1; done"
|
|
|
|
|
|
Run also contains a number of optional parameters:
|
|
Run also contains a number of optional parameters:
|
|
|
|
|
|
- .. code-block:: ruby
|
|
|
|
-
|
|
|
|
- docker::run { 'helloworld':
|
|
|
|
- image => 'base',
|
|
|
|
- command => '/bin/sh -c "while true; do echo hello world; sleep 1; done"',
|
|
|
|
- ports => ['4444', '4555'],
|
|
|
|
- volumes => ['/var/lib/counchdb', '/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'],
|
|
|
|
- }
|
|
|
|
|
|
+.. code-block:: ruby
|
|
|
|
+
|
|
|
|
+ docker::run { 'helloworld':
|
|
|
|
+ image => 'base',
|
|
|
|
+ command => '/bin/sh -c "while true; do echo hello world; sleep 1; done"',
|
|
|
|
+ ports => ['4444', '4555'],
|
|
|
|
+ volumes => ['/var/lib/counchdb', '/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
|
|
Note that ports, env, dns and volumes can be set with either a single string
|
|
or as above with an array of values.
|
|
or as above with an array of values.
|