Docker compose, heroku, hostname links and production deployment

In case anyone else comes across this in their current searches for solutions, Heroku offers an approach using a file similar to docker-compose.yml, called heroku.yml. You simply put it in the root of your project and structure it to call your Dockerfiles: https://devcenter.heroku.com/articles/build-docker-images-heroku-yml


Docker compose creates a docker virtual network which allows you to connect the containers using the container name as a hostname. Heroku doesn't directly support docker-compose, as Docker compose is really intended for local development on your own machine and not for production.

For production Docker has Docker swarm, which is very similar to Docker compose, however is intended for production environments. You can use the same docker-compose file (called stackfile in swarm) to deploy on swarm. In docker swarm, you can connect the containers that you have using the same service name just like you would do in docker-compose.

Heroku supports Docker swarm via the DockerHero add-on which you can use to to have your Docker container connected and running on Heroku.