A containerization is an approach to software development in which an application or service, its dependencies, and its configurations are packaged together as a container image. The containerized application can be tested as a unit and deployed as a container image instance to the host operating system (OS). Containers are great for continuous integration and continuous delivery (CI/CD) workflows. Containers also isolate applications from each other on a shared OS. Containerized applications run on top of a container host that in turn runs on the OS.
Each container can run a whole web application or a service, as shown in Figure. In this example, the Docker host is a container host, and App1, App2, Svc 1, and Svc 2 are containerized applications or services.
Containers offer the benefits of isolation, portability, agility, scalability, and control across the whole application lifecycle workflow. The most important benefit is the environment’s isolation provided between Dev and Ops.
Goals of Containers:
- Portability: Code is executed the exact same way in any machine
- Efficiency: containers are often designed to only exist as long as the process or application they run is needed, and stops once a task is complete.
- Statelessness: Statelessness is an ideal in container design that strives for code to always run the exact same way, without requiring knowledge of past or future code executions.
- Networking: While containers are often completely isolated from one another, there are many cases where containers must communicate with each other, with the host machine, or with a different cluster of containers.
We use Docker in such senario.