Docker containers are one of the most popular things in IT right now. But you probably learned in kindergarten that what is popular is not always right. So before jumping on the container train, you should make sure containers are really for you.
This post isn’t about denigrating Docker containers. They offer all sorts of benefits—from better app performance to more portability to easier management.
When to Use Docker, and When Not To
But there is wisdom in the adage that you shouldn’t fix what’s not broken. If your app already works well enough in a traditional, non-containerized environment, should you move it to Docker?
Before creating a Dockerfile and spinning up containers, ask yourself these questions:
- Will I benefit from the portability Docker will provide? Docker makes it very easy to move apps between any servers that have Docker running (as long as the underlying host operating systems are the same). But if you already have that portability in your existing software stack through virtual machines and live migrations, for example, you won’t gain anything in this respect from Docker.
- Will my app benefit from microservices? Another key Docker benefit is that Docker containers are ideal for hosting distributed apps. That’s great if your app is composed of multiple services that can be distributed. But if it’s not—if your app is a single, monolithic service—then Docker may not add much value for you.
- Does my app depend on a certain operating system? One limitation of Docker is that an app designed for Windows can’t run via Docker on a Linux host and vice versa. Virtual machines are not subject to this limitation; you can run a VMware or KVM guest image on any type of host operating system. So, think through this issue before you commit to Docker containers.
- Am I prepared to manage a Docker environment? Like any new technology, Docker comes with a learning curve. And because Docker is still pretty new, not everyone has experience with it. You don’t want to make yourself dependent on Docker if you’re not prepared to manage it properly.
- Will Docker require me to rebuild my entire app? If your app is designed in such a way that migrating to Docker will necessitate a complete rewrite of the entire codebase, you’re looking at a substantial amount of effort to adopt Docker. That effort could be worth it if the benefits of the migration are high enough. But think hard about that issue before you commit yourself to rebuilding from scratch.
If your answer to any of these questions is no, then a migration to Docker may not be worth the effort it requires—at least not with the apps and infrastructure you currently run.
You can always use Docker for new apps, or when you next make a major upgrade to your infrastructure. But adapting existing solutions that already work to new, Dockerized environments is not a trivial matter, and it’s not always the best thing to do.