8 min read

I’m not about to tell you containers is a hot new trend – clearly, it isn’t. Today, they are an important part of the mainstream software development industry that probably won’t be disappearing any time soon. But while containers certainly can’t be described as a niche or marginal way of deploying applications, they aren’t necessarily ubiquitous. There are still developers or development teams yet to fully appreciate the usefulness of containers. You might know them – you might even be one of them.

Joking aside, there are often many reasons why people aren’t using containers. Sometimes these are good reasons: maybe you just don’t need them.

Often, however, you do need them, but the mere thought of changing your systems and workflow can feel like more trouble than it’s worth. If everything seems to be (just about) working, why shake things up?

Well, I’m here to tell you that more often than not it is worthwhile. But to know that you’re not wasting your time and energy, there are a few important signs that can tell you if you should be using containers.

Containerize your apps with Docker and Kubernetes

Download Containerize Your Apps with Docker and Kubernetes for free, courtesy of Microsoft. 

Your codebase is too complex

There are few developers in the world who would tell you that their codebase couldn’t do with a little pruning and simplification. But if your code has grown into a beast that everyone fears and doesn’t really understand, containers could probably help you a lot.

Why do containers help simplify your codebase?

Let’s think about how spaghetti code actually happens. Yes, it always happens by accident, but usually it’s something that evolves out of years of solving intractable problems with knock on effects and consequences that only need to be solved later.

By using containers you can begin to think differently about your code. Instead of everything being tied up together, like a complex concrete network of road junctions, containers allow you to isolate specific parts of it.

When you can better isolate your code, you can also isolate different problems and domains. This is one of the reasons that containers is so closely aligned with microservices.

Software testing is nightmarish

The efficiency benefits of containers are well documented, but the way containers can help the software testing process is often underplayed – this probably says more about a general inability to treat testing with the respect and time it deserves as much as anything else.

How do containers make testing easier?

There are a number of reasons containers make software testing easier. On the one hand, by using containers you’re reducing that gap between the development environment and production, which means you shouldn’t be faced with as many surprises once your code hits production as you sometimes might.

Containers also make the testing process faster – you only need to test against a container image, you don’t need a fully-fledged testing environment for every application you do tests on.

What this all boils down to is that testing becomes much quicker and easier. In theory, then, this means the testing process fits much more neatly within the development workflow. Code quality should never be seen as a bottleneck; with containers it becomes much easier to embed the principle in your workflow.

Read next: How to build 12 factor microservices on Docker

Your software isn’t secure – you’ve had breaches that could have been prevented

Spaghetti code, lack of effective testing can lead to major security risks. If no one really knows what’s going on inside your applications and inside your code it’s inevitable that you’ll have vulnerabilities. And, in turn, it’s highly likely these vulnerabilities will be exploited.

How can containers make software security easier?

Because containers allow you to make changes to parts of your software infrastructure (rather than requiring wholesale changes), this makes security patches much easier to achieve. Essentially, you can isolate the problem and tackle it. Without containers, it becomes harder to isolate specific pieces of your infrastructure, which means any changes could have a knock on effect on other parts of your code that you can’t predict.

That all being said, it probably is worth mentioning that containers do still pose a significant set of security challenges. While simplicity in your codebase can make testing easier, you are replacing simplicity at that level with increased architectural complexity. To really feel the benefits of container security, you need a strong sense of how your container deployments are working together and how they might interact.

Your software infrastructure is expensive (you feel the despair of vendor lock-in)

Running multiple virtual machines can quickly get expensive. In terms of both storage and memory, if you want to scale up, you’re going to be running through resources at a rapid rate. While you might end up spending big on more traditional compute resources, the tools around container management and automation are getting cheaper.

One of the costs of many organization’s software infrastructure is lock-in. This isn’t just about price, it’s about the restrictions that come with sticking with a certain software vendor – you’re spending money on software systems that are almost literally restricting your capacity for growth and change.

How do containers solve the software infrastructure problem and reduce vendor lock-in?

Traditional software infrastructure – whether that’s on-premise servers or virtual ones – is a fixed cost – you invest in the resources you need, and then either use it or you don’t. With containers running on, say, cloud, it becomes a lot easier to manage your software spend alongside strategic decisions about scalability.

Fundamentally, it means you can avoid vendor lock-in. Yes, you might still be paying a lot of money for AWS or Azure, but because containers are much more portable, moving your applications between providers is much less hassle and risk.

Read next: CNCF releases 9 security best practices for Kubernetes, to protect a customer’s infrastructure

DevOps is a war, not a way of working

Like containers, DevOps could hardly be considered a hot new trend any more. But this doesn’t mean it’s now part of the norm. There are plenty of organizations that simply don’t get DevOps, or, at the very least, seem to be stumbling their way through sprint meetings with little real alignment between development and operations.

There could be multiple causes for this conflict (maybe people just don’t get on), but DevOps often fails where the code that’s being written and deployed is too complicated for anyone to properly take accountability. This takes us back to the issue of the complex codebase.

Think of it this way – if code is a gigantic behemoth that can’t be easily broken up, the unintended effects and consequences of every new release and update can cause some big problems – both personally and technically.

How do containers solve DevOps challenges?

Containers can help solve the problems that DevOps aims to tackle by breaking up software into different pieces. This means that developers and operations teams have much more clarity on what code is being written and why, as well as what it should do.

Indeed, containers arguably facilitate DevOps practices much more effectively than DevOps proponents have been trying to do in pre-container years.

Adding new product features is a pain

The issue of adding features or improving applications is a complaint that reaches far beyond the development team. Product management, marketing – these departments will all bemoan the ability to make necessary changes or add new features that they will argue is business critical.

Often, developers will take the heat. But traditional monolithic applications make life difficult for developers – you simply can’t make changes or updates. It’s like wanting to replace a radiator and having to redo your house’s plumbing.

This actually returns us to the earlier point about DevOps – containers makes DevOps easier because it enables faster delivery cycles. You can make changes to an application at the level of a container or set of containers. Indeed, you might even simply kill one container and replace it with a new one. In turn, this means you can change and build things much more quickly.

How do containers make it easier to update or build new features?

To continue with the radiator analogy: containers would allow you to replace or change an individual radiator without having to gut your home. Essentially, if you want to add a new feature or change an element, you wouldn’t need to go into your application and make wholesale changes – that may have unintended consequences – instead, you can simply make a change by running the resources you need inside a new container (or set of containers).

Watch for the warning signs

As with any technology decision, it’s well worth paying careful attention to your own needs and demands. So, before fully committing to containers, or containerizing an application, keep a close eye on the signs that they could be a valuable option. Containers may well force you to come face to face with the reality of technical debt – and if it does, so be it. There’s no time like the present, after all.

Of course, all of the problems listed above are ultimately symptoms of broader issues or challenges you face as a development team or wider organization. Containers shouldn’t be seen as a sure-fire corrective, but they can be an important element in changing your culture and processes.

Learn how to containerize your apps with a new eBook, free courtesy of Microsoft. Download it here.

Co-editor of the Packt Hub. Interested in politics, tech culture, and how software and business are changing each other.