Ask about the benefits of containers, and you’ll usually hear about how they help IT operations teams first and foremost. Containers make applications faster to deploy, easier to update and easier to isolate--all of which are tasks typically handled by IT operations engineers, not developers. But there's no doubt that the explosive popularity of containers has impacted programmers, too. Here’s a look at five ways that containers have changed (for the better) the way developers work.
What Are Containers?
Just in case it’s unclear, let’s start with a very brief overview of containers.
Containers are software-defined application environments that typically host individual applications or services. They’re different from virtual machines, which use hypervisors to virtualize an entire operating system. In addition, containers consume fewer system resources and start much faster than virtual machines, although they don’t provide quite as much isolation.
Docker and Kubernetes have brought container technology mainstream during the past five years, although other container frameworks existed decades ago.
1. Containers Make It Easier to Move to the Cloud
Perhaps the biggest benefit of containers for developers is that they simplify the process of “lifting and shifting” an application into the cloud: Once you “containerize” your application by designing it to run inside a container, you can deploy it in the same basic way both on-premises or in the cloud. The tools for deploying and managing containers are the same on both types of infrastructure.
For developers, this means that containerizing applications is one way to ease the transition of legacy software into the cloud--or to ensure that new applications will be cloud-ready from the start. Along similar lines, containers make it easier to move applications between different clouds as needed.
2. Containers Contain Microservices
Today, you no longer write a monolithic application and deploy it on a single server somewhere. Instead, to maximize scalability and availability, modern applications tend to be deployed as a set of microservices hosted on distributed infrastructure.
A common challenge that developers face in writing microservices-based applications, however, is keeping each service neatly separated from other ones. Containers help address this challenge by providing an easy way to separate code during both development and deployment.
With containers, you can simply break your development pipeline into multiple branches, with each one targeting a different microservice hosted in a different container.
3. Containers Reduce Environment Variables
If you’re a developer who creates cross-platform applications, one of the most tedious parts of your job is making sure that your application can run in environments that are configured differently. It’s easy to write an app if it will always be deployed on exactly the same type of operating system. It’s harder when you have to worry that the operating system, file system hierarchy, user interface and so on might vary from one deployment to another.
Containers help to solve this problem by providing a consistent deployment environment for applications. If you develop a Linux app to run inside a Docker container, you can generally expect it to behave in the same way on any Linux distribution that has Docker installed. The same is true on Windows.
The major caveat here is that a Linux container can’t usually run on Windows, and vice versa. Thus, containers don’t provide total cross-platform compatibility. But, from the perspective of developers, they do smooth over the differences between different versions of the same operating systems.
4. Containers Make It Easy to Reuse Code
For developers, it’s always easier to borrow code that already exists than to reinvent the wheel by writing your own code to implement the same functionality. Containers make it easy to borrow someone else’s code. In a container, you can import parts of an application from external repositories with just a few commands inside the container’s configuration file.
You could reuse third-party code directly within a non-containerized application’s codebase, of course, but it would usually require more effort.
5. Containers Make It Easier to Secure Applications
In some respects, containers make it easier to develop secure applications because they isolate services and applications from one another. This isolation won’t do anything to prevent insecure code within a container from being exploited. But it at least helps to stop the spread of an exploit from one container to another.
The flipside is that containers also create new security challenges for developers (in conjunction with IT engineers) to address.
The bottom line: Although much of the hype surrounding containers has focused on how they benefit IT operations teams, containers have also led to big changes in the way developers create, test and secure applications.