Heroku vs Docker - Detailed Comparison 2019
- Nazar A.
- 17min read
Heroku and Docker both allow developers to develop, deploy and run applications inside containers. A container is a virtual environment that runs on top of a single operating system kernel, allowing applications to run with a fraction of the resources required for a virtual machine or bare metal computer system. Containers also permit applications to be scaled quickly and permit easy transition from development to production. Although both Heroku and Docker, offer a containerized solution to software deployment and management, they are very different in terms of implementation and terminology. Each system also offers a variety of pros and cons.
What is a Container?
A container is a software system that permits applications to share a single operating system. A container system will typically consist of a container engine, a Host operating system and a processor.
- Container Engine - in this case Docker or Heroku is a managed environment used to deploy containerized applications. The container engine manages the core and memory. It also manages spatial isolation and security for the individual applications and permits scalability.
- Host Operating System (OS) - the host operating system (usually Linux) provides a user interface, manages resources such as memory and executes and provides services for the applications.
- Processor - also called the Central Processing Unit, it is responsible for carrying out all tasks, based on instructions from the operating system and application.
Advantages of Containers
Because containers allow applications to share resources, they offer several advantages, including:
- Reduced costs-Containers reduce costs by allowing applications to share resources.
- Increased reliability and robustness-Containers allow for quick failover and recovery.
- Scalability-Containers allow for the number of applications to quickly and easily be scaled up and down.
- Isolation-Containers isolate each application with its own resources in a namespace. As a result, although applications share resources, they are functionally isolated from one another. This also means that faults in one application are isolated from others, making containers safer than virtual machines or bare metal systems.
- Continuous integration-Because containers can easily be destroyed and deployed; they support iterative processes such as Agile.
- Portability-Containers are very portable permitting an easy switch from development to production and are especially effective in cloud environments.
- Security-The modular design of containers increases isolation and makes systems harder to attack and limits the impact of malware.
- Container processes must write information only to the container specific file systems.
- The container namespace must be isolated to a private intranet.
- Container privileges must be isolated.
Heroku is a Platform as a Service (PaaS) and was one of the first cloud platforms created in 2007. Heroku originally only supported Ruby, but now supports Java, Node.js, Python, PHP and others. Heroku consists of the following components:
- BuildPack-A Heroku BuildPack is a set of scripts which are used to create an image. The BuildPack determines the language that the application can be run in, including Java, Python, Ruby and others. Heroku comes with default BuildPacks for various languages or developers can build their own.
- Slug-When you run a BuildPack, it creates a packaged copy of your application called a Slug. Slugs contain all the facilities to run an application and can be deployed quickly and easily.
- Dyno-According to Heroku, “Dynos are isolated, virtualized Linux containers that are designed to execute code based on a user-specified command.” Using Dynos, applications can be scaled to any level based on resource requirements.
- Add-Ons-Preconfigured building blocks that can be purchased for Heroku to build more complex applications.
- Command Line Interface (CLI)-Command Line Interface used to manage Heroku containers.
Ever considered DeployPlace as an alternative to Heroku to avoid being vendor-locked?
Docker is an open source tool designed to create, manage, deploy and run applications within containers. Unlike Heroku, which must be run in its own cloud-based environment, Docker can be installed on a laptop, server or cloud-based environment such as Amazon Web Services (AWS). Docker consists of the following high-level components:
- Dockerfile-A Dockerfile is a set of commands used to build a Docker image (see below). Dockerfiles also dictate the final configuration of the Docker image.
- Docker Image-A Docker image is created by running a Dockerfile (see above). A Docker image is a multi-layered file, which contains all the resources, dependencies, data, files and settings necessary to run your application. Each time a Docker image is started, it creates a container of the same application, providing for easy scalability.
- Index-Docker images can be uploaded to the Index and shared with the Docker Community. This allows other users to build complex applications from individual Docker image components, downloaded from the Index.
- Command Line Interface (CLI)-Like Heroku, Docker offers a CLI for managing containers.
Docker and Heroku Terminology
|Build File-Set of commands to build images.||DockerFile||BuildPack|
|Image-Contains all resources for running the application.||Docker Image||Slug|
|Container-Static file that includes executable code to run an isolated process.||Docker Container||Dyno|
|Index-Source of application building blocks.||Docker Index||Add-Ons|
|Command Line Interface.||CLI||CLI|
Docker vs Heroku
Although Docker and Heroku share a common concept, containerization of applications, there are some major differences between the two platforms.Heroku provides both the container to run the application, as well as the infrastructure to host it. In other words, Heroku provides all the advantages of containerization, but you must also run it on the Heroku platform. This makes Heroku very easy to set up and run, but there are also some limitations. Unlike Docker, Heroku cannot be run on on-premise servers or on a private cloud based service.
Advantages of Heroku
- Heroku is easy to set up, implement and deploy. Heroku manages the hardware, software and other resources allowing developers to focus almost solely on development of their applications.
- Heroku supports many different languages including:
- Heroku is a Polyglot Platform-Using various BuildPacks, developers can deploy apps in almost any programming language.
- Heroku Dynos permit easy development and usability-Because Heroku manages and runs the application, it frees the developer from managing the operating system and other system configurations.
- Heroku permits instant scalability-By increasing or decreasing the number of Dynos, Heroku can easily be scaled up or down.
Disadvantages of Heroku
- Applications run on Heroku can only be run on the Heroku platform. As a result, Heroku cannot be run on in-house servers or on private clouds. Take a look at DeployPlace to avoid being vendor-locked.
- Heroku applications can only be run using the Linux operating system.
- Cost-Although Heroku offers a free version, the standard package starts at $25 per month.
Heroku is very expensiveHeroku is too expensive. Many companies prefer to find, recruit and train DevOps engineers to set up and support deployment infrastructure. Very often the costs of recruiting, training, salaries, office are ignored. While the main focus is to make a better product, recruiting and managing DevOps teams can be defocusing.
Heroku is not secure enoughSometimes Heroku is considered to be not secure enough. But Heroku is much more secure than your homemade deployment infrastructure. Heroku has a separate team working on security issues. Heroku security features have been tested on thousands of real customer’s applications. Heroku’s security is absolutely fine for most of the industries that do not require additional certification.
Customers of Heroku who are trying to go the free route to save money will make use of that lower-cost tier, but may encounter ‘sleeping apps’ when the system shuts down resources in order to save the company money. That’s an unpleasant surprise and a very inconvenient type of metering for unaware users! It’s basically ‘deliberate downtime’ and you pay to not have that!
There’s also a lack of ownership of the servers and process where Heroku stores instances in multi-tenant shared servers. Clients don’t really have a choice in where servers get deployed, in some senses.
Advantages of Docker
- Can be run on virtually any environment-Docker can be run on in-house servers, private cloud systems or even Heroku PaaS itself.
- Customizable-because Docker can be run on virtually any platform, it can be customized to meet all your needs.
- Security-Because Docker can be run on in-house servers, it can be secured to your satisfaction.
- Operating System-Docker can run on a variety of operating systems including Linux, Windows and others.
- Cost-Docker on AWS is relatively inexpensive, starting at approximately $4.75/month.
Disadvantages of Docker
- Difficult to configure-In comparison to Heroku, Docker’s flexibility means that it also requires more configuration to set up properly.
Dev teams sometimes can run into problems with Docker, many of them having to do with the open source nature of the technology. In many different types of use cases, overlay networking causes latency. That latency can be a problem, especially for companies that need to run close to the bare metal to achieve objectives in real time.
Another major problem with Docker is the urge to import valuable data into a Docker container image, and keep it there. As containers are often built for stateless functionality, data that is supposed to be persistent gets lost. When that happens, it can become a real mess. Experts and seasoned developers always caution against putting persistent data where it isn’t supposed to be, urging others to “castle the rook” every time.
Comparison Docker vs Heroku
|Flexibility||Very flexible deployment||Inflexible deployment|
|Ease of use||More complex configuration||Easy configuration|
|Portability||Very Portable||Not Portable|
|Price||Inexpensive to host||More expensive|
Deploying Docker on Heroku
It is possible to enjoy the best of both worlds by deploying Docker on Heroku’s infrastructure. Heroku’s platform makes set up and deployment simpler and virtually risk free. Although the initial expense to deploy on Heroku is more expensive when compared to a platform like AWS, many companies end up saving money on Heroku because of all the time saved on configuration when compared to other platforms.
The advantages of deploying Docker on Heroku, include the following:
- Greater parity between the development and production environment.
- Greater control over how the package is built. For example, if your application uses a language that doesn’t use standard buildpacks, you can build it in Docker.
The major disadvantage of deploying Docker on the Heroku platform is that you lose some of the automatic configuration features of Heroku and assume more of the responsibility. If you use the standard slug compiler and default stacks, Heroku will automatically check for security updates, update the stacks and then migrate your application automatically. Using the Docker container however, Heroku can’t do that and responsibility falls to the person managing the application.
Which companies use Docker and Heroku?
Docker is rated 4.4 out of 5 on G2Crowd by 200 customers.Many companies choose Docker to rapidly deploy server environments in containers without creating virtual machines.
- ADP - used Docker to build a secure software supply chain to serve its nearly 40 million active users in 113 countries.
- ALM. Brand - ALM brand streamlines its Oracle WebLogic applications and builds new applications with Docker Enterprise.
- ASSA ABLOY - ASSA ABLOY is famous lock manufacturer uses Docker Enterprise to speed up its delivery of electronic interfaces and lock hardware to the market.
- Baker Hughes GE - The deployment time was reduced from 6 months to 1 hour with Docker.
- GlaxoSmithKline - Docker Enterprise is used to speed up the drug delivery model and to improve research.
- Visa - Visa used Docker to refactor its payment processing applications and finally achieved 10x scalability increase.
Heroku is often chosen by startups and industry leaders for fast building of powerful data-driven applications that can be shipped fast. Docker is rated 4.3 out of 5 on G2Crowd by 76 customers.
- Altus Assessments - Altus Assessments uses Heroku to run thousands of data-intensive tests.
- SwimTopia - Heroku helps SwimTopia to scale seamlessly during peak seasons.
- SHIFT Commerce - SHIFT commerce’s rapid growth become possible with Heroku electronic interfaces and lock hardware to the market.
- ClickFunnels - ClickFunnels used Heroku’s Flexible Data Services to seize the opportunity for growth.
- Moneytree - Moneytree focuses on their business, while Heroku takes care of data security and compliance
- DrivenData - Heroku provides a secure platform for data science applications of DrivenData.
Heroku and Docker are both excellent options for containerization. They can both run applications with a wide variety of languages including Java, Ruby, PHP and others. They also offer easy scalability and deployment.
The major difference between Heroku and Docker is in their implementation. Both Heroku and Docker operate using containers, a self-contained instance of code that contains everything required to run an application, including code, resources and tools. Heroku however provides the container inside of its own Heroku deployment pipeline. This makes Heroku amazingly easy to configure, because the entire package, container and environment is already configured for you. Heroku is perfect for new developers or small companies who want to deploy applications within a set environment without the hassle of complicated configuration.
Docker on the other hand provides a containerization model, which can be run on a wide variety of platforms, from in-house servers, to private clouds, AWS or even within a Heroku environment itself. As a result, Docker is far more flexible in terms of deployment when compared to Heroku. Along with this flexibility however comes a more complex deployment process.
Docker therefore is better suited to companies with more specific configuration requirements. For example, if you require a very secure environment for your applications, you can run Docker on-premise and configure security to your specifications. The greater flexibility also brings with it a degree of complexity. Where Heroku is basically ready to run straight out of the box, Docker requires more configuration based on your needs.
In some cases, developers may be able to take advantage of the features of both platforms by deploying Docker on Heroku. This alleviates many of the deployment and implementation headaches that come with Docker on other PaaS platforms but does allocate more responsibility to the application manager in comparison to a pure Heroku deployment. On the other hand, greater responsibility also provides you with greater control over your application.
Why use DeployPlace?
Many software deployment mistakes today are as a result of the lack of a deployment tool. With DeployPlace, you can have all the deployment problems solved, with server configurations taken care of and zero-downtime during deployments.
DeployPlace knows how valuable time is, so it ensures that you can deploy your software ten times faster compared to doing so manually. It also increases productivity, allowing you to reuse your deployment templates for several projects.
You can try out DeployPlace on your projects, or as a lone-wolf developer, you can pick the free plan which may suit your needs perfectly.