Deploying Apps to Heroku with Docker

Yesterday Heroku released beta support to build and deploy Heroku apps with Docker. It would be an understatement to say that this created quite a bit of buzz inside Appirio. We are big fans of Docker and have been promoting it for all types of uses, blogging about it and using it for our topcoder challenges. With so many developers on the topcoder platform (750,000+), Docker mitigates environment issues involved with launching challenges, evaluating submissions and putting code into production.

Since Heroku has their own LXC container technology, we didnt expect them to adopt Docker this soon if at all. We are super-excited to see Heroku starting to support Docker! The service is still beta, only supporting Node.js and Ruby for now (more languages to come), but looks promising.

The announcement blog post does a good job of walking you through the new functionality but assumes that you have a strong grasp of Docker and your installation is up to date. A number of my teammates had issues with Docker Hub and getting their containers to run on Heroku but these are Docker problems, not Herokus.

If you are new to Docker and running OSX, try installing Kitematic or use this page to install Docker and Boot2Docker. You can download Docker for other platforms here. If you already have a version of Docker installed, I would highly recommend that you upgrade your client and server. Youll probably need to update your virtual machine as well so check out these instructions. Its pretty simple.

With everything installed/updated you should be able to run boot2docker up which will fire up Docker and your VM. Now youre all set to follow Herokus blog post to deploy your container to their platform.

Herokus Docker toolbelt plugin makes dockerizing apps a breeze. You can run heroku docker:init in your apps directory and the CLI will try to detect what language and framework is used for your app and in what versions, and write the appropriate Dockerfile for you! Feel free to make modifications and rebuild your images as necessary.

A simple heroku docker:start fires up your app locally in the virtual machine and returns an accessible IP address. You can then do all sorts of crazy stuff like installing dependencies with heroku docker:exec and modifying your app in real-time against the virtual machine (it mounts a working directory) before deploying to Heroku.

Once again, Heroku has made deployment a snap. When you run heroku docker:release, the CLI will create a slug from your local Docker image and deploy it to Heroku. You can still use git push as well if you like watching the buildpack logs. Who doesnt?!

Overall, this is a good start. Im not sure how much I like the being forced into Herokus /app structure but I can understand the need for it. It will be exciting to see how their support progresses in the near term. Over the past six months Heroku has made it much simpler to deploy apps with options from github and Dropbox and now Docker!

Cross-posted from topcoder.