Base image with runit-based service supervision
10K+
The image builds upon the latest Debian Jessie, and adds a thin init + service supervision layer.
The purpose is mostly for internal use at UNIT9, but there's nothing bundled that makes it UNIT9-specific.
PID 1 duties (spawn runit, reap zombies) are handled with a simple Go program written by Peter Bourgon and hosted on Github, license MIT.
Service supervision is handled with runit.
Programs that insist on logging to syslog are handled with socklog.
Source on Github: https://github.com/unit9/docklabs
debian:jessie;Makefile for easy builds and uploads:
make build to buildmake push to push to Docker Hubmake shell gives you a shell in the (ephemeral) container/etc/rc.local to initialise & self-check the containerDockerfilePull unit9/base:latest and customise this example:
FROM unit9/base:latest
MAINTAINER You <[email protected]>
RUN apt-get update && \
apt-get install --yes my-favourite-stuff && \
rm -rf /var/cache/apt /var/lib/apt/lists
ADD run_my_stuff /etc/service/run_my_stuff/run
ADD rc.local /etc/rc.local
VOLUME /data/run_my_stuff
EXPOSE 1234
Notice that neither cmd or exec are defined; this is the role that
runit takes.
Inside the file run_my_stuff, there should be a shell script that
reads the environment and sets up the service. For example:
#!/bin/sh
set -eu
echo $UPSTREAM_PORT | sed -E 's#tcp://(.+):(.+)#\1 \2#' | {
read host port
echo >&2 host=$host port=$port
cat > /etc/my_stuff.conf <<EOF
name my_stuff
host $host
port $port
EOF
}
echo >&2 "Starting my stuff"
exec /usr/bin/my-stuff --config /etc/my_stuff.conf
Inside of rc.local, is another simple shell script, which can
perform any one-off initialisation tasks or self-checks:
#!/bin/sh
set -eux
test -f /var/www/html/index.html
lighttpd -t -f /etc/lighttpd/lighttpd.conf
exit 0
Make sure the script returns a non-zero code on an error. Your container will exit upon failure - this is useful to e.g. stop a bad deployment before the rolling update brings everything down.
See the file LICENSE.
Content type
Image
Digest
Size
58.2 MB
Last updated
over 7 years ago
docker pull unit9/base