Reno, NV    +1 (800)0 621-0871

Go back


Learning Docker: Using Phusion’s Base Image

  |  May 21, 2014

baseimage-docker saves me time by fixing the problems I haven’t realized yet:

  • customizes ubuntu with sensible defaults to make it more compatible with Docker
  • provides a custom init script
  • installs OpenSSH
  • installs runit (allows container to start multiple processes)

I wanted to run the nginx that came with the image and here’s how I used the base image in my Dockerfile:

RUN rm -f /etc/service/nginx/down
Building a new image (run this where the Dockerfile is located):
$ docker build .
Spin up a new container:
docker run -P --rm -t -i 85bb79def5a8 /sbin/my_init --enable-insecure-key
Some notes:

  • -P publishes all listening ports
  • –rm removes the container upon exit
  • -t creates a pseudo tty
  • -i use the image ID
  • /sbin/my_init is the base image’s custom initialization script (starts SSH and nginx)
  • I’ve setup the base image to use a default SSH key for easy access during development.

Recommended Reading