Video Transcript


Docker support updates: Local data stores and more languages

Today we're releasing some exciting improvements to the Heroku beta Docker support announced 3 months ago: Automatic configuration of local containers running data stores (like Postgres, Redis and MongoDB) and support for many more languages including images for Node.js, Ruby, Go, Java, Scala, Clojure and Gradle. This helps you use local containers to run, test and deploy Heroku apps that have complex service dependencies with minimal setup and configuration.

Heroku Docker support brings to your machine the Linux containerization technology that we have operated for many years. These local Docker containers make on-boarding, development and testing of apps simpler and faster, and with Docker Compose, you can quickly spin up apps consisting of multiple containers and services. With the new tools announced today, you can use Docker to test, run and deploy Heroku apps faster and more reliably. We can’t wait to see what you build.

How to use

Make sure you have an updated version of Heroku Toolbelt, a working Docker installation and the heroku-docker plugin installed:

$ heroku plugins:install heroku-docker

Grab a sample app:

$ git clone https://github.com/heroku/ruby-getting-started
$ cd ruby-getting-started

Have the plugin configure your local Docker development setup:

$ heroku docker:init
Wrote Dockerfile
Wrote docker-compose.yml

The init command determines which Docker images are required for your app by reading the 'image' and 'add-ons' keys from app.json. It combines this with the processes from your Procfile to create and link together the Docker services for your local development environment.

You're now ready to run your app locally, including a Postgres container:

$ docker-compose up web
rubygettingstarted_herokuPostgresql_1 is up-to-date
Starting rubygettingstarted_web_1...
Attaching to rubygettingstarted_herokuPostgresql_1, rubygettingstarted_web_1

You can now try out the app, running on your machine:

$ open "http://$(docker-machine ip default):8080"

Note how you don’t have to download, install and configure Postgres (or Redis if that had been required). You don't even need to worry about installing the right Ruby version: It comes installed on the Cedar-14 based Ruby image maintained by Heroku.

And, when you move to another codebase, you can quickly spin that up in a new set of isolated containers. You can be confident that they're built with the right language version, running the correct database release. And you don’t need to worry about stomping on test data or config related to the first app.

Because you're testing in Linux containers based on Heroku's stack image, you get high fidelity dev/prod parity with your app's production environment on Heroku, letting you catch bugs and discrepancies before deploying.

Once your app is ready, you can use the plugin to deploy to Heroku:

$ heroku create
$ heroku docker:release
$ heroku open

When you invoke heroku docker:release, the plugin creates a Heroku-compatible slug and deploys it to Heroku. The plugin also ensures that any add-ons found in app.json, but not on the Heroku app are added before release.

Check out the Dev Center documentation for details on what languages are supported and for more on how to use the Heroku Docker tools with code that you maintain.


We're excited to see how Docker is bringing the power of containers from platforms like Heroku to developers' laptops. At Heroku, we'll continue to leverage Docker to help you quickly get started on and switch between codebases built with the many languages and add-ons that our platform supports.

Don't hesitate to send feedback to local-docker-dev@heroku.com or participate in development on GitHub.

Originally published: August 18, 2015

Browse the archives for news or all blogs Subscribe to the RSS feed for news or all blogs.