What is Docker containerization?
Containerization has recently grown more popular, with Docker as the typical container platform. Docker is an open-source containerization platform that allows applications to function independently of the host operating system. Using Docker partially resolves the common “it worked on my computer” problem faced by many development teams.
To understand Docker, you should understand a few concepts and technologies:
- Virtualization: The process of logically dividing hardware resources.
- Containers: A virtualization technology used to package an application with its dependencies.
Docker’s primary purpose is to streamline application development and deployment. It has become a cost-effective solution for development teams that require identical development environments, often hosted on shared physical hardware.
Docker is also useful for geographically distributed teams to pull from shared resources on edge servers rather than requiring local installations of each resource.
Why Docker was developed
Before containers, application development was tricky. Developers needed to set up a development environment. This meant installing multiple libraries and dependencies: a very time-consuming process. Multiply that by the number of developers working on the application, and however many operating systems they used.
This quickly became a time-consuming process with a lot of room for error, compounded during deployment, which also required replicating the application's environment. There were many opportunities to introduce compatibility issues along the way.
Developers initially relied on virtual machines (VMs) to test and deploy server applications. However, VMs are very resource-intensive, requiring a hypervisor to access hardware resources, emulate an entire guest operating system, and run the application.
While virtual machines benefited developers by isolating applications from other programs and emulating different operating systems, they required substantial computing power and storage space.
The OCI standard
In the early 2010s, some developers at the company that eventually became Docker, along with some peers at CoreOS (now defunct), began development and eventually formed the Open Containers Initiative (OCI) in 2013 to create a standard for containers that is still in use today.
Docker and the OCI streamlined development by packaging all components together, thus reducing the number of installations required by each developer and increasing resource efficiency.
The OCI standard ensured containers would work predictably across platforms, without relying on specific vendors or technologies. Essentially, using an OCI container future-proofs an application.
You can read more about the OCI. Specifically, Docker donated the runc codebase.
How does Docker work?
The Docker engine functions under a RESTful architecture, which means it is decentralized and uses many separate resources. Docker is also based on Ubuntu, and its architecture and naming conventions follow similar formats.
Docker creates files as follows:
A Dockerfile is a text file that tells Docker what components it needs to run.
The Dockerfile is converted into an image, a static artifact containing the Dockerfile, libraries, and dependencies. A Docker Registry is a repository of shareable images, with DockerHub as the largest public library.
The Container is the executable form of the image. If you open up Task Manager on a PC and search "container," you will likely find at least one container running as a background process. They are very lightweight, so the impact on your overall system resources is quite low.
The Daemon listens for and carries out requests between the client (you) and host (everything in the container).
Use cases for Docker
Docker is typically used to isolate an application from the rest of the host system for stability, compatibility, or security.
Isolating the application from the host is beneficial in modern development environments where multiple developers work on an application and need a standardized development environment. Containers are also helpful because there might be distinct versions of an application in development, such as a development and a production version. By containerizing the application, they can run without the increased resources of a virtual machine.
Docker is also useful for applications that interact frequently with other applications, such as microservices, which rely on APIs to communicate with other applications. Docker increases scalability for these applications because you can just deploy additional containers when it is time to scale up.
Conclusion
Thanks to Docker’s role in establishing the OCI standard and the utility of its containers, Docker has remained the leading container platform for application development. Its contributions to the OCI standard also assure that applications developed with Docker will function if moved to another platform. These factors collectively contribute to Docker’s popularity among developers.
To see how to implement Docker, visit our other Bunny Academy article linked in the sidebar. You can also refer to the Docker documentation for more details.