Docker is a buzz word in ‘Devops’ and there is a big chance that you would have heard about it at least once. It is getting immensely popular among developers and sysadmins and organizations like Cisco, Google, Huawei, IBM, Microsoft, and Red Hat are taking huge interests in Docker. Docker is also getting popular in Cloud Technologies like AWS and Azure.
In the world, where Devops is shifting toward Containerized Solution, I think ,it’s important to understand some of the fundamental concepts of Docker.
What is Container: Containers are platforms which run on the top of OS. On one OS , multiple containers cane be created which are isolated.
Container vs VMs: Containers have similar resource isolation and allocation as virtual machines but a different architectural approach allows them to be much more portable and efficient. Following picture depicts the difference between containers and VMs.
- Virtual machines include the application, the necessary binaries and libraries, and an entire guest operating system — all of which can amount to tens of GBs.
- Containers include the application and all of its dependencies –but share the kernel with other containers, running as isolated processes in user space on the host operating system.
What is Docker: Docker is the most popular containerized platform. Docker is also known as a tool for packing, shipping, and running applications within “containers”.
Docker Benefits: Containers as a concept is decade old but following are the main benefits because of which Docker has become a rage in Devops
- Lightweight and Fast: Docker containers are very lightweight and fast. Since containers are just sandboxed environments running on the kernel, they take up fewer resources. Docker images are typically very small, which facilitates rapid delivery and reduces the time to deploy new application containers.
- Simple Configurations and Easy to Use: One of the reason for its popularity amongst Developers and Sysadmins is, Docker is very easy to configure. Docker has made is easy for anyone to build and deploy and run applications in docker
- Isolation: Docker ensure your application and resource are isolated and segregated. As per Gartner, Docker containers are as good as VM hypervisors when it comes to isolating resources.
- Modularity Portability: Docker has made it easy to break your application functionality into individual containers: For Ex: one might have a ‘NoSql’ Db running in a container, while ‘Sql Server’ running in another container and .Net application running in another.
- Portability: Since containers and isolated and self-contained, they are easily portable. For docker, an application and all its dependencies can be bundled into a single container which is independent on host kernel or platform distribution. This container can be transferred to any other machine that runs docker and can be executed without any compatibility issue.
- Version Control: Since Docker containers are built as layered architecture, one can track versions of a container, inspect differences and roll-back to previous versions.
- Security: Docker ensures that applications that are running on containers are completely segregated and isolated from each other, granting you complete control over traffic flow and management. No Docker container can look into processes running inside another container. From an architectural standpoint, each container gets its own set of resources ranging from processing to network stacks.
Docker Components: Fundamental understanding of docker components is necessary to create a docker container.
Following are fundamental components
- Docker Engine: It is the layer on which Docker runs: It is a lightweight tooling that manages containers, images, builds and more.
- Docker engine is made up ofDocker Daemon : A server which is a type of long-running program called a daemon process.
- Docker Client: A command line interface (CLI) client.
- A REST API which specifies interfaces that programs can use to talk to the daemon and instruct it what to do.
The CLI uses the Docker REST API to control or interact with the Docker daemon through scripting or direct CLI commands.
- Docker Image: Image is a read only file which is built from docker file. The Docker image is built using a Dockerfile. lightweight yet powerful structure. Docker images are the build component of Docker.
- Dockerfile: it is configuration file which contains instructions for images. Each instruction in the Dockerfile adds a new “layer” to the image, with layers representing a portion of the images file system that either adds to or replaces the layer below it. Layers are key to Docker’s
- Containers: Docker containers are built off Docker images. In other words, Containers are runnable instance of Docker images.Since images are read-only, Docker adds a read-write file system over the read-only file system of the image to create a container. Docker containers are the run component of Docker.
- Registry: Registry can be considered as “Hub of Images”. A registry can be public or private. Docker registries are the distribution component of Docker.
- Docker Services: A Docker service allows a swarm of Docker nodes to work together, running a defined number of instances of a replica task, which is itself a Docker image. You can specify the number of concurrent replica tasks to run, and the swarm manager ensures that the load is spread evenly across the worker nodes. Docker services are the scalability component of Docker.
Further read: To know more about Docker please see the following links.