From 93aecd8fcf54c45e7ebfe7aabe8aad87b8f934b7 Mon Sep 17 00:00:00 2001 From: "Hongli Lai (Phusion)" Date: Sun, 2 Feb 2014 14:18:33 +0100 Subject: [PATCH] Work in progress --- index.html | 42 ++++++++++++++++++++++++++++++++++++------ 1 file changed, 36 insertions(+), 6 deletions(-) diff --git a/index.html b/index.html index 0b23d85..6d01e18 100644 --- a/index.html +++ b/index.html @@ -107,6 +107,8 @@

+ Tweet + @@ -270,6 +272,25 @@ CMD ["/sbin/my_init"] # Clean up APT when done. RUN apt-get clean && rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/* +

Adding additional daemons

+

You can add additional daemons (e.g. your own app) to the image by creating runit entries. You only have to write a small shell script which runs your daemon, and runit will keep it up and running for you, restarting it when it crashes, etc.

+ +

The shell script must be called run, must be executable, and is to be placed in the directory /etc/service/<NAME>.

+ +

Here's an example showing you how to a memached server runit entry can be made.

+ +
### In memcached.sh (make sure this file is chmod +x):
+#!/bin/sh
+# `chpst` is part of running. `chpst -u memcache` runs the given command
+# as the user `memcache`. If you omit this, the command will be run as root.
+exec chpst -u memcache /usr/bin/memcached >>/var/log/memcached.log 2>&1
+
+### In Dockerfile:
+RUN mkdir /etc/service/memcached
+ADD memcached.sh /etc/service/memcached/run
+ +

Note that the shell script must run the daemon without letting it daemonize/fork it. Usually, daemons provide a command line flag or a config file option for that.

+

More documentation

This website only covers the basics. Please refer to the Github repository for more documentation. Topics include:

-

Relevant links

- +

Having problems? Want to participate in development? Please post a message at the discussion forum.

+ +
+ + + + +
@@ -309,7 +333,13 @@ RUN apt-get clean && rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/*

- Phusion +
+ + + + +
+

Phusion