Following up with my previous post, let me show an example of setting up a container with sshd running by default, under daemontools supervision:

Key commands:

  • update-service from daemontools-run Ubuntu package is used here to add the service directory in /etc/sshd. This is really just a fancy way in Ubuntu to do cd /etc/service && ln -sf /etc/ssh/service sshd which would be done otherwise on other systems.
  • docker ps -l -q is a very useful Docker idiom, so much that I've made and alias of it in my .bashrc as docker last.
  • docker inspect can be used to retrieve external information about the running container, such as its IP address, that can then be used on the host to connect to (like in this example, via ssh.)

You can get this image from the Docker index under zakame/base, default root password is docker. Additionally, I set sshd to not use PAM authentication here as I'm on a Slackware host, and I needed to make /var/run/sshd manually this directory is normally made at startup during init.