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/host_integration.rst

60 lines
1.5 KiB
ReStructuredText
Raw Normal View History

:title: Host Integration
:description: How to generate scripts for upstart, systemd, etc.
:keywords: systemd, upstart, supervisor, docker, documentation, host integration
2013-10-09 15:31:40 -04:00
Host Integration
================
You can use your Docker containers with process managers like ``upstart``,
``systemd`` and ``supervisor``.
Introduction
2013-10-09 15:31:40 -04:00
------------
If you want a process manager to manage your containers you will need to run
the docker daemon with the ``-r=false`` so that docker will not automatically
restart your containers when the host is restarted.
2013-10-09 15:31:40 -04:00
When you have finished setting up your image and are happy with your
running container, you may want to use a process manager to manage
it. When your run ``docker start -a`` docker will automatically attach
to the process and forward all signals so that the process manager can
detect when a container stops and correctly restart it.
Here are a few sample scripts for systemd and upstart to integrate with docker.
2013-10-09 15:31:40 -04:00
Sample Upstart Script
---------------------
2013-10-09 15:31:40 -04:00
.. code-block:: bash
description "Redis container"
author "Me"
start on filesystem and started lxc-net and started docker
stop on runlevel [!2345]
respawn
exec docker start -a 0a7e070b698b
Sample systemd Script
---------------------
2013-10-09 15:31:40 -04:00
.. code-block:: bash
[Unit]
Description=Redis container
Author=Me
After=docker.service
2013-10-09 15:31:40 -04:00
[Service]
Restart=always
ExecStart=/usr/bin/docker start -a 0a7e070b698b
ExecStop=/usr/bin/docker stop -t 2 0a7e070b698b
[Install]
WantedBy=local.target