Can we marry a Docker container and a monolith?
Running monolith app with Docker containers
15 February 2018
If you think you can’t run your legacy monolithic app using Docker, think again. While microservices apps are best-suited for Docker, there’s no reason you can’t benefit from Docker with a monolithic app, too.
It’s a common misconception that Docker only makes sense if the app you want to host is composed of microservices, each of which can be deployed inside a separate container.
In fact, while it’s true that Docker is ideal for hosting distributed, microservices apps, monolithic deployments can benefit from Docker, too.
Even if your app is a monolith, Docker still gives you the following advantages:
- Portability – Docker makes it easy to move your app from one host to another by migrating the container image. That portability applies whether your app is monolithic or distributed.
- Scalability – Docker allows your app to scale up or down easily in response to fluctuating demand by spinning containers up or down.
- Bare-metal access – With Docker containers, your app can access bare-metal hardware. That’s a clear advantage over virtualization platforms that require hypervisors.
- Easy distribution – By packaging your app as a Docker container, you make it easy to distribute through an image repository. Anyone to whom you give access can pull the container image and run it. That beats having to install it manually via an installation process that could vary depending on which environment your users have.
- Environment consistency – Docker containers provide a consistent environment that you can use for development, testing, staging and deployment of your app. Environment consistency can help you build a continuous delivery pipeline.
All of the above will help you deploy your app more efficiently and with greater agility even if it runs as a monolith.
That matters because it means Docker can help you make the most of your legacy apps even if you don’t have time to refactor or rebuild them.
In an ideal world, you’d have the time and resources to rewrite all of your monolithic apps so that they can be distributed as microservices. But in the real world, you often have to deploy the apps you have, not the apps you wish you had. There’s no reason Docker can’t help you do that, even if your app is a monolith.