You can find some basic instructions on creating a base image in the docker docs and have a look at the mkimage
-scripts in the source code's contrib directory. What it boils down to is you use the debootstrap
tool to create a ubuntu/debian root filesystem, tar this and import it into docker. An example for building a minimal ubuntu precise (12.04 LTS) image from scratch would be:
debootstrap --verbose --variant=minbase --include='iproute,iputils-ping' --arch=amd64 precise /tmp/precise/ `curl -s http://mirrors.ubuntu.com/mirrors.txt | head -1`
The last curl bit will pick a ubuntu mirror close to your machine's location, you can also simply pass a standard ubuntu mirror url - note that this mirror picked will now be hard-coded into your new images etc/apt/sources.list
, so you might want to amend it before packaging by editing it according to this
The supervision of running processes within docker containers is something that is not the task of your containers themselves - they are just in charge of running any given command in an isolated environment. The daemon-management part should happen on your docker host machine, i.e. you could write an upstart job for each of your desired containers.