in Coding, DevOps

Docker vs. Heroku

Untitled drawing

Since a couple of weeks I am working with Docker as an application container for Amazon’s EC2. Despite my eternal fight with the Docker registry, I am absolutely amazed about Docker and enjoyed my experience.

But sometimes it is hard to explain what Docker is and what is has to do with all this cloud and PaaS and scalability topic. So I thought a little bit about some similar concepts between Docker and Heroku -maybe the most popular PaaS provider. But let’s start with a small…


Docker and Heroku maybe have similar concepts (as you will see below), but they are two completely different things: while Docker is an open source software project, Heroku is a commercial service provider. You can download, build and install Docker on your own laptop or participate on its online community. On Heroku, you can create yourself an user account, pay some money (maybe) and get a really great service and hosting experience for your applications and code. So obviously, Docker and Heroku are very different things. But some of their core concepts have at least some similarities.

Docker vs. Heroku

Docker Heroku
Dockerfile BuildPack
Image Slug
Container Dyno
Index Add-Ons

Docker and Heroku have a lot of similarities, especially in their core concepts. This makes Docker an interesting alternative for people who are looking for an alternative for Heroku – maybe on their own infrastructure.

Dockerfile vs. BuildPack

Docker images can be build with a Dockerfile. A Dockerfile is a set of commands, e.g. to add files and folders or to install packages. It defines how the final image should look like. Here is an example of a Dockerfile which installs memcache from the official website:

Heroku’s pendant are so called BuildPacks. BuildPacks are also a set of scripts which are used to setup the final state of an image. Heroku comes with a couple of default BuildPacks such as for Java, Python or the Play! framework. But you can also write your own. Here’s a snippet of the Heroku BuildPack for Java apps:

BTW, there are even projects to enable the usage of Heroku’s BuildPacks for Docker images (like this).

Image vs. Slug

When you run a Dockerfile, it creates a Docker image. Such an image contains all data, files, dependencies and settings you need for your application. You can exchange those images and start them right away on any machine with Docker installed.

When you run a build on Heroku, the BuildPack creates a so called Slug. Those slugs are “are compressed and pre-packaged copies of your application” as Heroku says. Similar to Docker’s images, they contain all dependencies and can be deployed and started in a very short time.

Container vs. Dyno

After starting a Docker image, you have a running container of this image. You can start an image multiple times, to get multiple isolated container of the same application. This enables you to build an image once and start easily multiple instances of it.

Heroku does the very same. After you build your app with your BuildPack, you get a slug which you can run on a Dyno. Such a dyno is “a lightweight container running a single user-specified command” as Heroku describes it.

Heroku even uses LXC for virtualization of their containers (dynos), which is the same technology Docker uses at its core.

Index vs. Add Ons

Docker images can be shared with the community. This is possible by uploading them to the official Docker index. All images on this index can be download and used by everyone. Most of them are documented very well and can be started with a single command. This makes it possible to run a lot of applications as building blocks. Here’s an example how to run elasticsearch:

A similar concept applies to Heroku’s add-on market. You can use (or buy) different pre-configured add-ons for your application (e.g. for elasticsearch). This makes it possible to build a complex app with common building blocks – such as Docker is doing it!

So both, Docker’s index and Heroku’s add-ons, underline a service oriented way of developing applications and reusing components.


2014-05-05 17_28_04-C__Users_tuhrig_Desktop_AWSRepo_formations_RELEASE_7.0.0.5_PIM.json (static) - S

Although the four points mentioned before are the most important concepts of both, Docker and Heroku have one more thing in common: both have a powerful command line interface which allows to manage containers. E.g. you can run heroku ps to see all your running slugs or docker ps to see all your running containers or you can request the log of a certain container.


Best regards,


  1. Thanks! very useful article! Helped clear up a few misconceptions I had.
    I thought they were similar technologies. I guess I am going to have to do what you have done and play with both a little more.

  2. So, both satisfy the same requirements right? Its only about one is paid and other is free. Did I get it right?

    • Both, Heroku and Docker, have very similar concepts. So under the hood, they do the same things. However, there are also major differences (despite of the pricing) between them. Heroku is a managed service whereas Docker is only a tool you need to run and host by yourself. So while Heroku will do everything for you in the background (that’s what you pay for), you could also do that with Docker. But with Docker you must do it your self and that might be a lot of work.

      • So what’s best to deploy a RESTful API- heroku or docker?

  3. Very good article. It nicely answered the questions I had in my mind. I just started on both and I was confused by the similarities.

  4. while reading heroku and dynos, first question that popped up in my mind – is not it similar to docker? and then I did a search and found my answers.
    Thank you for such a crisp to the point compilation.

  5. guys i have a question i want to know the prerequisite for DevOps,

    here are the things i know

    can i do a course for devops

    PS: i am student of btech it(final year),But i love development and was thinking of doing devops course.any guidence will be appreciated.

    • Hey Arul, I think you are on a pretty good way! Heroku is great and a lot of DevOps tools like “Puppet” are written in Ruby. Maybe you could also dig into things like “Continuous Delivery”, “Automation” (maybe with “Puppet” if you already know Ruby) and “Docker” (which is great for DevOps _and_ developers).

  6. Diese Nachricht wird hier mit XRumer + XEvil 4.0 veröffentlicht
    XEvil 4.0 ist eine revolutionäre Anwendung, die fast jeden Anti-Botnet-Schutz umgehen kann.
    Captcha Anerkennung Google (ReCaptcha-1, ReCaptcha-2), Facebook, Yandex, VKontakte, Captcha Com und über 8,4 Millionen andere Typen!

    Sie lesen das – es bedeutet, dass es funktioniert! 😉
    Details auf der offiziellen Website von XEvil.Net gibt es eine kostenlose Demo-Version.

    See also:
    1 rucaptcha BING Captcha ReCaptcha2 836

  7. Thank you for your sharing about the knowledge between docker and heroku. It is very helpful to be clear with the concepts.

  8. Who can help with the problem of potency?
    What advise a preparation?

Comments are closed.


  • DevOpsLinks is Awesome – It's Coming Soon January 24, 2019

    Hi All im newbie here. Tolerable article! Be fond of your stories!

  • DevOpsLinks is Awesome : Curated & Must Read Content For DevOps, SysAdmins & Fullstack Developers. – | A DevOps Enthusiast Blog – Aymen El Amri January 24, 2019

    Hi All im newbie here. Tolerable article! Be fond of your stories!

  • DevOpsLinks #8: Using Docker & ElasticSearch on Azure, Docker Networking And The Complete DevOps Glossary | DevOpsLinks: Free newsletter for DevOps and SysAdmins January 24, 2019

    Hi All im newbie here. Tolerable article! Be fond of your stories!

  • [轉貼] Docker v.s. Heroku | Victor Gau January 24, 2019

    Hi All im newbie here. Tolerable article! Be fond of your stories!

  • [研討會資訊][PaaS] Pivotal 與 Heroku討論 | Blog E – Attitude is everything January 24, 2019

    Hi All im newbie here. Tolerable article! Be fond of your stories!