Last updated on December 9th, 2022 at 06:31 am
Docker Containers
What are docker containers? Docker is a platform for developing, shipping, running applications using container virtualization technology. Docker aids in separating your application from your infrastructure and helps in treating your Infrastructure like the way you would treat any managed application.
Docker aims to provide a lightweight way to create containers to manage and deploy your applications with isolation and security where you can get more out of your hardware.
The docker platform consists of various platforms and tools :
- Docket Engine
- Docket Hub
- Docket Machine
- Docket Swarm
- Docket Compose
- Kitematic
Current approach i.e without dockerizations 🙂 involves having a physical server, installing an operating system, and then deploying the application on it.
The fundamental issues with this approach is that the deployment times are slower, as you would need to provision a server with the necessary specifications, wait for it to arrive etc. The cost is relatively high as you need multiple servers with dedicated CPU and RAM.
Also scaling the application is harder as you would need to buy new servers. This approach also has issues when you are reliant on one type of server by a certain manufacturer.
Virtualization solved all the above issues, by having virtualization software you technically can have multiple applications running on one server and allocating resources to each Virtual Machine (VM). With virtualization, you can use your resource pool and allocate the necessary resources to the application needed. Scaling is also a lot simpler and you have rapid elasticity to scale at will.
Virtualization on the cloud – With AWS and Azure or Rackspace you can do this with little to no effort. A couple of clicks of a button and you have a VM running. Also with virtualization on the cloud, you can even set it up so that VM are automagically deployed when there is an increase in traffic.
Here each VM needs to have its own OS, CPU, and RAM. Since each VM needs to have a dedicated OS you also lose space every time a VM is created on the server + the licensing cost of additional OS installations unless you are using an open-source OS.
Even if you visualize this there and allocate CPU, Memory, and hard disk space on a VM each application does not end up utilizing ALL the allocated resources.
Containerization – Containers basically use the kernel on the host operating system to run multiple guest instances. Here each guest instance is called a container. Each container has its own –
- Root File system
- Process
- Memory
- Device
- Network Ports
Here we segregate each application that has its independent container and the container interacts with the OS of the Kernel. What this means is that each container can have its own third-party libraries and versions of Java running.
Advantages of Containers over VMs
- Containers are more lightweight
- Every container does not need a dedicated Guest OS
- Containers require Less CPU, RAM, and storage space in comparison.
- You can have multiple containers in one VM
- Greater Portability
Docker Terminology
Docker Engine or Daemon – is the program that enables the containers to be built, shipped, and run. The Docker engine uses Linux kernel and namespaces and control groups. where namespaces give us the isolated workspace.
Docker Containers – Are kind of like directories and hold the application that you would like to deploy. Each container is an Image and like any VM can be started, stopped, moved, and deleted. Each docker container is isolated and secure. They do not need to virtualize any hardware. They end up using lesser CPU, RAM, and storage. Think about having many containers in a Virtual Machine.
The has a client-server architecture and the clients take inputs and send them to the Daemon, the Daemon then builds, runs, and distributes the containers. It is important to note that the Client and Daemon can run on the same host or on different hosts.
Docker is gaining popularity several organizations have taken up using docker in production. There are also smaller startups like ContainerX trying to cash in on this market by supporting docker-type implementations for enterprise customers.
Recommended reading:
Docker: Up & Running: Shipping Reliable Containers in Production.