Container
What Is a Container?
A container is a software unit that packages an application with its code, libraries, dependencies, and configuration files. They are run as isolated processes but share the host operating system kernel. This is different from a virtual machine, which will usually have its own guest operating system. By having consistent application environments throughout development, testing and deployment issues can be reduced.
How Does a Container Work?
A container is created based on a container image. This defines the application files to run, runtime, libraries and any dependencies. A container runtime such as Docker Engine or containerd will create an isolated process. This will define the filesystem, networking and resource constraints. On a Linux OS features such as Namespaces and Control Groups will be used to isolate the processes. This will allow an application to be run with the host OS kernel. Any changes to the container’s writeable layer will be temporary unless persistent storage is used.
Key Characteristics of Containers
- Lightweight execution: Shares the host operating system kernel instead of running a separate guest operating system.
- Incursion Separation: For the first time a container application delivers its own processes and isolates its own files from other container files
- Image based Deployment: The application launched in a container already includes everything included in its container images from third party services
- Portability: The applications perform the same way in all environments equipped with corresponding runtime environments.
- Independent Life Cycle: The container application starts, stops, and replaces itself independently of its other counterparts.
- Resource management: The CPU and the memory usage of the application are managed by the operational settings.
Benefits of Containers
- Uniform surroundings: Containers allow apps to deliver its dependencies from development through test to production without changes in the setup.
- Optimal use of resources: Containers share host kernels, meaning fewer resources are needed.
- Speeding up the deployment process: Containers operate as processes rather than an OS needing to boot fully.
- Simplifying updating any applications: Teams can simply change or update the old containers with improved images without reworking the entire host environment.
- Separate workloads: Applications run in separate containers, decreasing the number of conflicts among dependencies.
Containers in Cloud Computing
Cloud platforms utilize virtual machines or physical servers to run containers using host OS for running containerized jobs. Notably, a single virtual machine in the cloud can run many containers rather than provisioning different virtual machines for each service component.
Kubernetes and similar container orchestration platforms allow teams to deploy containers over the cluster. Kubernetes schedules containers in Pods, while execution of containers is handled by container runtime at each node in the cloud infrastructure. Furthermore, cloud service providers also provide managed container services, where they take care of some aspects of the infrastructure and orchestration. However, container configuration is still necessary for aspects like networking, persistent storage, resource restrictions, and security.