1
0
Fork 0
mirror of https://github.com/moby/moby.git synced 2022-11-09 12:21:53 -05:00

Update documentation

This commit is contained in:
Andy Rothfusz 2013-10-09 12:31:40 -07:00 committed by Victor Vieux
parent 3e014aa662
commit 8cf0f2dbe5

View file

@ -2,67 +2,124 @@
:description: How to generate scripts for upstart, systemd, etc. :description: How to generate scripts for upstart, systemd, etc.
:keywords: systemd, upstart, supervisor, docker, documentation, host integration :keywords: systemd, upstart, supervisor, docker, documentation, host integration
Host Integration
================
You can use your Docker containers with process managers like ``upstart``,
``systemd`` and ``supervisor``.
Introduction Introduction
============ ------------
When you have finished setting up your image and are happy with your running When you have finished setting up your image and are happy with your
container, you may want to use a process manager like `upstart` or `systemd`. running container, you may want to use a process manager to manage
it. To help with this, we provide a simple image: ``creack/manger:min``
In order to do so, we provide a simple image: creack/manger:min. This image takes the container ID as parameter. We also can specify
the kind of process manager and metadata like *Author* and
This image takes the container ID as parameter. We also can specify the kind of *Description*. The output will will be text suitable for a
process manager and meta datas like Author and Description. configuration file, echoed to stdout. It is up to you to create the
.conf file (for `upstart
If no process manager is specified, then `upstart` is assumed. <http://upstart.ubuntu.com/cookbook/#job-configuration-file>`_) or
.service file (for `systemd
Note: The result will be an output to stdout. <http://0pointer.de/public/systemd-man/systemd.service.html>`_) and
put it in the right place for your system.
Usage Usage
===== -----
Usage: docker run creack/manager:min [OPTIONS] <container id>
.. code-block:: bash
docker run creack/manager:min [OPTIONS] <container id>
.. program:: docker run creack/manager:min
.. cmdoption:: -a="<none>"
Author of the image
.. cmdoption:: -d="<none>"
Description of the image
.. cmdoption:: -t="upstart"
Type of manager requested: ``upstart`` or ``systemd``
Example Output
..............
.. code-block:: bash
docker run creack/manager:min -t="systemd" b28605f2f9a4
[Unit]
Description=<none>
Author=<none>
After=docker.service
[Service]
Restart=always
ExecStart=/usr/bin/docker start -a b28605f2f9a4
ExecStop=/usr/bin/docker stop -t 2 b28605f2f9a4
[Install]
WantedBy=local.target
-a="<none>": Author of the image
-d="<none>": Description of the image
-t="upstart": Type of manager requested
Development Development
=========== -----------
The image creack/manager:min is a `busybox` base with the binary as entrypoint. The image ``creack/manager:min`` is a ``busybox`` base with the
It is meant to be light and fast to download. compiled binary of ``manager.go`` as the :ref:`Entrypoint
<entrypoint_def>`. It is meant to be light and fast to download.
Now, if you want/need to change or add things, you can download the full If you would like to change or add things, you can download the full
creack/manager repository that contains creack/manager:min and ``creack/manager`` repository that contains ``creack/manager:min`` and
creack/manager:dev. ``creack/manager:dev``.
The Dockerfiles and the sources are available in `/contrib/host_integration`. The Dockerfiles and the sources are available in
`/contrib/host_integration
<https://github.com/dotcloud/docker/tree/master/contrib/host_integration>`_.
Upstart Upstart
======= -------
Upstart is the default process manager. The generated script will start the Upstart is the default process manager. The generated script will
container after docker daemon. If the container dies, it will respawn. start the container after the ``docker`` daemon. If the container
Start/Restart/Stop/Reload are supported. Reload will send a SIGHUP to the container. dies, it will respawn. Start/Restart/Stop/Reload are
supported. Reload will send a SIGHUP to the container.
Example: Example (``upstart`` on Debian)
`CID=$(docker run -d creack/firefo-vnc)` ...............................
`docker run creack/manager:min -a 'Guillaume J. Charmes <guillaume@dotcloud.com>' -d 'Awesome Firefox in VLC' $CID > /etc/init/firefoxvnc.conf`
You can now do `start firefoxvnc` or `stop firefoxvnc` and if the container .. code-block:: bash
CID=$(docker run -d creack/firefo-vnc)
docker run creack/manager:min -a 'Guillaume J. Charmes <guillaume@dotcloud.com>' -d 'Awesome Firefox in VLC' $CID > /etc/init/firefoxvnc.conf
You can now ``start firefoxvnc`` or ``stop firefoxvnc`` and if the container
dies for some reason, upstart will restart it. dies for some reason, upstart will restart it.
Systemd Systemd
======= -------
In order to generate a systemd script, we need to -t option. The generated In order to generate a systemd script, we need to use the ``-t``
script will start the container after docker daemon. If the container dies, it option. The generated script will start the container after docker
will respawn. daemon. If the container dies, it will respawn.
Start/Restart/Reload/Stop are supported. ``Start/Restart/Reload/Stop`` are supported.
Example (fedora): Example (``systemd`` on Fedora)
`CID=$(docker run -d creack/firefo-vnc)` ...............................
`docker run creack/manager:min -t systemd -a 'Guillaume J. Charmes <guillaume@dotcloud.com>' -d 'Awesome Firefox in VLC' $CID > /usr/lib/systemd/system/firefoxvnc.service`
You can now do `systemctl start firefoxvnc` or `systemctl stop firefoxvnc` .. code-block:: bash
and if the container dies for some reason, systemd will restart it.
CID=$(docker run -d creack/firefo-vnc)
docker run creack/manager:min -t systemd -a 'Guillaume J. Charmes <guillaume@dotcloud.com>' -d 'Awesome Firefox in VLC' $CID > /usr/lib/systemd/system/firefoxvnc.service
You can now run ``systemctl start firefoxvnc`` or ``systemctl stop
firefoxvnc`` and if the container dies for some reason, ``systemd``
will restart it.