Docker is a widely used tool in the world of enterprise software development. It can be difficult to understand the motives behind its widespread usage. In this article we will take a quick look at why Docker has become the preferred choice for user community worldwide in software development.
The challenge earlier was of packaging any application, irrespective of language/frameworks/dependencies, so that it can run on any environment, irrespective of the underlying OS/hardware/infrastructure. Maintaining multiple technology stacks across multiple environments was a night-mare. One also has to worry about migrating to a different technology/upgrades etc. which not only makes it more complex but not possible to support without having huge impact.
Virtual machines (VM), are like simulations of a computer running inside of your real computer. A virtual machine simulates all the parts of a real computer, including the screen and the hard drive, which on the real computer (often referred to as the host) is just a big single file (called a virtual hard drive). The virtual hard drive can be of order of several gigabytes.
Using a virtual machine can be a heavy task for a processor. The host operating system has control over how much processing power it gives to a program, and VirtualBox asks for a lot of power, so virtual machines often run very slowly. It can be especially taxing to run several VMs at once. Running several instances of the same OS is clunky, redundant, and unnecessary, often defeating the purpose of running a virtualized OS in the first place.
The solution to slow virtual machines was Containers. A container runs natively on Linux and shares the kernel of the host machine with other containers. It runs a discrete process, taking no more memory than any other executable, making it lightweight. Developers can focus on bundling applications and dependencies as containers, without agonizing over underlying hardware/infrastructure. Administrators/DevOps team can concentrate on managing containers, without agonizing over the contents of those containers.
By contrast, a virtual machine (VM) runs a full-blown “guest” operating system with virtual access to host resources through a hypervisor. In general, VMs provide an environment with more resources than most applications need.
Containerization is increasingly popular because containers are:
- Flexible: Even the most complex applications can be containerized.
- Lightweight: Containers leverage and share the host kernel.
- Interchangeable: You can deploy updates and upgrades on-the-fly.
- Portable: You can build locally, deploy to the cloud, and run anywhere.
- Scalable: You can increase and automatically distribute container replicas.
- Stackable: You can stack services vertically and on-the-fly.
Containerization makes CI/CD seamless. For example:
- applications have no system dependencies
- updates can be pushed to any part of a distributed application
- resource density can be optimized.
Introduction of Docker helped in isolating the worries of developers and administrators. Docker is an open platform for developers and sys admins to build, ship, and run distributed applications whether on laptops, data centers, VMs or cloud. Docker lets you quickly assemble applications from components and eliminates the friction that can come when shipping code.
Docker is an engine that provides the ability to package and run an application in a loosely isolated, lightweight, portable, self-sufficient environment called a container. Docker, like VM, “virtualizes” an operating system inside of a host operating system. Docker is a tool used to run containers. Containers are sort of like virtual machines.
Docker simplifies software delivery process by allowing to create an image that contains your application and underlying infrastructure i.e. entire environment, managed as one component. These images are then used to create Docker containers which run on the container virtualization platform, provided by Docker. Your application typically requires specific versions for your operating system, application server, JDK, and database server, own configuration files, and similarly multiple other dependencies. The components and configuration together required to run your application is what is referred to as application operating system.
Docker lets you test and deploy your code into production as fast as possible. With Docker, scaling your application is a matter of spinning up a new executable, not running heavy VM hosts. Docker containers are very useful for creating isolated environments for separate programs to run in without interfering with each other. They make it very easy to tinker in a throw away environment without risking your main host setup.