From 0773820b7a9a9a81bb69b938e3e317915352daec Mon Sep 17 00:00:00 2001 From: "Hongli Lai (Phusion)" Date: Tue, 12 Nov 2013 12:37:16 +0100 Subject: [PATCH] Update README --- README.md | 30 +++++++++++++++++++++++++++++- 1 file changed, 29 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index f07fd70..4affd00 100644 --- a/README.md +++ b/README.md @@ -7,7 +7,7 @@ Baseimage-docker is a [Docker](http://www.docker.io) image meant to serve as a g * **Twitter**: https://twitter.com/phusion_nl * **Blog**: http://blog.phusion.nl/ -## Why should I use baseimage-docker? +### Why should I use baseimage-docker? Why use baseimage-docker instead of doing everything yourself in Dockerfile? @@ -32,6 +32,14 @@ Why use baseimage-docker instead of doing everything yourself in Dockerfile? Baseimage-docker is very lightweight: it only consumes 4 MB of memory. +## Inspecting baseimage-docker + +To look around in the image, run: + + docker run -rm -t -i phusion/baseimage bash -l + +You don't have to download anything manually. The above command will automatically pull the baseimage-docker image from the Docker registry. + ## Using baseimage-docker as base image The image is called `phusion/baseimage`, and is available on the Docker registry. @@ -58,6 +66,26 @@ By default, it allows SSH access for the key in `image/insecure_key`. This makes # 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 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/services/`. + +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/services/memcached + ADD redis.sh /etc/services/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. + ## Building the image yourself If for whatever reason you want to build the image yourself instead of downloading it from the Docker registry, follow these instructions.