In this article, we want to introduce and review one of the products that specialize in the field of operating system virtualization. this product is named Docker. To know what is Docker and How does it work, follow this article on the Orcacore website to the end.
What is Docker and How does it work?
Docker is an open-source platform that is set up based on a Linux operation system. It is a tool that can ease the creation, implementation, and performance processes with the containers.
Another answer to what docker is, it is a kind of virtual machine that makes it possible to programs use a Linux kernel unit. and profited by features that aren’t in the host operating system. this will significantly improve the speed and performance of the program and reduce its volume.
What is a container?
The purpose of the new improved software systems is to keep programs in an isolated environment and independent. In this way, their activities aren’t affected by each other, and they work independently.
One of the ways that you can use this technology, is to use a virtual machine that keeps the programs on hardware but separated from each other. in this case, components don’t interfere with each other and reduce the competition of using hardware sources.
But what is a container? against virtual machines, are containers. they can be the best replacement for virtual machines. containers separate the executive environments and share the operation system’s core.
Containers use fewer sources than virtual machines and also they are executable so fast.
Containers can be divided into three parts:
- Builder (technology used to build containers)
- Engine (technology used to container startup)
- Orchestration (technology used for container settings and management)
What is a Docker container?
Even the container concept has existed in the IT field, but introduce and presentation of Docker as an open-source project causes the use of containers to be pervasive again.
The container gives the possibility to developers that make a whole package of their programs with all requirements sections and send them as a whole package unit.
With the containers, developers can be sure that the docker program in every machine is applicable and usable with Linux OS without attention to custom settings. The new machine can have different settings from the machine on which the program is designed.
We have to use different components to build a Docker program as well as work with Docker. In the following, we will introduce and review these components.
Every container starts to work with a docker file. To answer the question of what a docker file is, docker files actually are docker settings files that with the use of them we can tell docker how to set up and configure a container. as an example, what services to enable and how to allow access to them.
Actually, the docker file specifies which OS is located behind our container, also uses which languages, local variables, network ports and etc., and which is important more is to specify that after our container is actually run, what is supposed to do.
In the below table we describe keywords used in the docker file:
|FROM||Specify the image used in the Container|
|MAINTAINER||Manufacturer and Container Descriptions|
|RUN||Execute the command when the Container is created|
|CMD||Execute a command after the Container is created|
|ENTERYPOINT||Execute a command after the Container is created|
|LABEL||Add metadata to the Container|
|EXPOSE||Specify the ports that the Container will allow to access after ascending|
|ENV||Add local variables to the Container|
|ADD||This means to Add or copy or link a file or directory to a Container|
|COPY||Add or copy a file or directory to a Container without linking|
|VOLUME||Add a mount point to the host machine or other containers|
|USER||Set a user or UID in Container|
|WORKDIR||Set the executable directory in Container|
When you have finished writing the docker file, you call a feature called Docker Build, which is responsible for creating an image based on the contents of your Docker file.
The Docker Image is a portable file that contains a set of instructions that specify which software components the Container should run and how to run it.
Docker run actually, is a kind of command that sets up the container. Every container is an example of an image and the nature of the container is temporary. However, they can be stopped or re-setup again.
Each image can have a large number of containers, provided it has a unique name.
Docker Hub is a SaaS repository for managing and sharing containers. In this section, you can find the official Docker images, which are usually open-source.
This section is the core of Docker. In fact, when someone talks about Docker, they are talking about Docker Engine. This feature is offered in both Enterprise and Community versions.
The community version is open-source and totally free. However, the enterprise version with additional features and capabilities costs about $ 1,500 per node per year.
What is the mechanism of action of Docker?
At this point, we know what is Docker and how it works. In this part, we want to discuss what is the mechanism of action of docker.
Docker creates an interface between the main operating system and the software package.
In the Linux operating system, there are capabilities for separating and isolating resources that provide both the core of the operating system and the groups and hardware and software resources of the operating system in isolated and separate software, of which the Docker system is one Uses.
For example, features such as cgroups and kernel namespaces are some of the things that Docker uses.