While a few other types of containers are available, Docker is the de facto standard for containerization. Containerization involves running multiple applications in containers on a Docker Engine that runs on an underlying operating system. The principles of Agile software emphasize simplicity, interactions among individuals, working software, customer collaboration, and responsiveness to change. Docker containers make all of these feasible.
Containerization has become the paradigm for software development, software packaging, and software use in less than a decade. While a few other types of containers are available, Docker is the de facto standard for containerization. As a primer, containerization involves running multiple applications in containers on a Docker Engine that runs on an underlying operating system. This is in contrast to traditional virtual machines (VMs) that require a complete operating system per VM. In this article we shall discuss what makes containerization Agile. The principles of Agile software emphasize simplicity, interactions among individuals, working software, customer collaboration, and responsiveness to change. Docker containers make all of these feasible.
Docker containers are lightweight as compared to virtual machines, something that offers several benefits out-of-the-box. Simplicity of software packaging is best delivered by containers. The Linux kernel is fully utilized; no more wasted operating system resources. The following diagram (Figure 1) illustrates the Docker containers. Each Docker container runs in isolation on the same Docker Engine that runs on an underlying operating system. A single container uses up only a snapshot of resources (kernel CPU, memory).
Figure 1. Docker containers running on Docker Engine
Collaboration in Software Development
Docker image based software could be developed in collaboration with multiple developers. As an example, the following diagram (Figure 2) illustrates multiple code developers, each developing code on a branch of a GitHub code repository. An automated process creates a single Docker image from the GitHub code.
Figure 2. Collaboration among Docker code developers
The microservices architecture has replaced the monolithic architecture for software design. Whereas a single application is run in a monolithic design, with microservices design multiple services, or applications, form a collective whole with each service performing only a subset of the application’s functionality. The advantages of microservices are division of responsibility, lack of dependency on a single language, or framework, ease of software updates, scalability, and fault isolation. Microservices are best packaged in containers because containers offer the benefits of isolation; each container has its own filesystem and networking. A container includes all the dependencies, libraries, and code that it needs to run packaged together. The following diagram (Figure 3) illustrates the microservices architecture for an application.
Figure 3. Microservices
Decoupling of Software Components
Perhaps one of the greatest benefits of containers is the isolation and decoupling it provides to the different components of software. One container could be running the main software, another logging, and another monitoring. If you need to update the logging software you don’t need to update the other software components as well. The following diagram (Figure 4) for a Model-View-Controller application illustrates the decoupling between the different software components. The software is connected, and yet decoupled. Making changes in one component does not require making changes in every other component.
Figure 4. Decoupled Software
Support for Multiple Platforms
Docker containers are supported by multiple platforms. You can find a different Docker image for a software to run in different operating systems (Linux and Windows) and on different architectures, which makes the software running in the containers portable across multiple platforms. The following diagram (Figure 5) illustrates support for a Docker image on different OS/Arch. Some of the instructions in a Docker image’s Dockerfile would be different, but essentially the same software gets installed.
Figure 5. Multiple OS/Arch are supported
Support on Most Cloud Platforms
Cloud computing has revolutionized how software and services are distributed and used. Different categories of cloud services have evolved such as SaaS (Software as a Service), PaaS (Platform as a Service), IaaS (Infrastructure as a Service), and DBaaS(Database as a service). Containerization is supported by most leading cloud service providers. Most cloud platforms provide a managed service for containers, which makes container-based software development easier.
Usable with CI/CD Data Pipelines
Containers are well suited to be used in continuous integration (CI), and continuous deployment (CD) of software. A container-based data pipeline that runs from start (code repository) to finish (deployment) could be automated with user interaction at milestones to build and deploy software. Users are able respond to change by making a code pipeline rerun, as an example. “Continuous delivery of valuable software” is the first of the 12 Agile manifesto principles. Working software gets delivered faster if using containers. The following diagram (Figure 6) illustrates an automated data pipeline.
Figure 6. CI/CD with Docker
After initializing the data pipeline, the sequence that is repeated in the data pipeline to make software available continuously is as follows:
- Code developer/s make changes in code on Github
- A new code build is initiated
- A new version of the Docker image is created
- The Docker image is tested in a test environment such as Jenkins.
- The software is deployed in production environment
An end user of the software does not notice any significant interruption in service.
The Docker Hub is a public repository of Docker images. The Docker images could be customized by making minor changes to suit a developer’s needs. Customer collaboration is made possible by making the Docker image instructions in a Dockerfile few and simple. An example is that of customizing a MySQL database with a Dockerfile.
Quick Installation and Configuration of Software
If you have used a Docker image to download, install, and configure software that you previously installed using binaries, the first thing you notice is that the software gets installed and configured rather quickly. As an example, it could take half a day to download, install, and configure Oracle Database from binaries. But, it takes less than an hour with a Docker image.
Docker containers are supported by several orchestration platforms that make it easier to manage container-based software. Kubernetes is the most commonly used open source orchestration platform used for automating deployment, scaling, and management of container-based software. Some of the benefits of Kubernetes are well established after more than 15 years of use in production. These benefits include:
- Automatic rollout of changes. Automatic rollback on failure.
- Automatic mounting of a chosen storage system
- Configuration updates without Docker image rebuilds
- Batch workloads
- Automatic service discovery and load balancing
- Automatically restarts failed containers
- Automatic horizontal scaling based on CPU usage