host_integration.rst 2.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768
  1. :title: Host Integration
  2. :description: How to generate scripts for upstart, systemd, etc.
  3. :keywords: systemd, upstart, supervisor, docker, documentation, host integration
  4. Introduction
  5. ============
  6. When you have finished setting up your image and are happy with your running
  7. container, you may want to use a process manager like `upstart` or `systemd`.
  8. In order to do so, we provide a simple image: creack/manger:min.
  9. This image takes the container ID as parameter. We also can specify the kind of
  10. process manager and meta datas like Author and Description.
  11. If no process manager is specified, then `upstart` is assumed.
  12. Note: The result will be an output to stdout.
  13. Usage
  14. =====
  15. Usage: docker run creack/manager:min [OPTIONS] <container id>
  16. -a="<none>": Author of the image
  17. -d="<none>": Description of the image
  18. -t="upstart": Type of manager requested
  19. Development
  20. ===========
  21. The image creack/manager:min is a `busybox` base with the binary as entrypoint.
  22. It is meant to be light and fast to download.
  23. Now, if you want/need to change or add things, you can download the full
  24. creack/manager repository that contains creack/manager:min and
  25. creack/manager:dev.
  26. The Dockerfiles and the sources are available in `/contrib/host_integration`.
  27. Upstart
  28. =======
  29. Upstart is the default process manager. The generated script will start the
  30. container after docker daemon. If the container dies, it will respawn.
  31. Start/Restart/Stop/Reload are supported. Reload will send a SIGHUP to the container.
  32. Example:
  33. `CID=$(docker run -d creack/firefo-vnc)`
  34. `docker run creack/manager:min -a 'Guillaume J. Charmes <guillaume@dotcloud.com>' -d 'Awesome Firefox in VLC' $CID > /etc/init/firefoxvnc.conf`
  35. You can now do `start firefoxvnc` or `stop firefoxvnc` and if the container
  36. dies for some reason, upstart will restart it.
  37. Systemd
  38. =======
  39. In order to generate a systemd script, we need to -t option. The generated
  40. script will start the container after docker daemon. If the container dies, it
  41. will respawn.
  42. Start/Restart/Reload/Stop are supported.
  43. Example (fedora):
  44. `CID=$(docker run -d creack/firefo-vnc)`
  45. `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`
  46. You can now do `systemctl start firefoxvnc` or `systemctl stop firefoxvnc`
  47. and if the container dies for some reason, systemd will restart it.