First thing was to Dockerise an erlang pub/sub server. The problem is that application can only be started in console or daemon mode. So let’s use some shell tricks to wait daemon.

start # start daemon
child=$! # keep the pid in child variable
wait ${child} # wait daemon process finish

The application also need to have database ready on boot. This is not possible with docker because the containers are just started without dependency. But there is a trick with links by using docker-wait.

mongodbready:
  image: aanand/wait
  links:
    - mongodb

app:
  image: app
  links:
    - mongodbready
    - mongodb

Dockerfile ADD instruction handle URL with cache support. It’s useful when you have to get a source tarball.

docker-compose can handle env files like dotenv project, and pretty useful when you have a Rails container and a sidekiq container that share the same environment.