Technology Security Analyst
Docker Hosts are the machines on which Docker daemon runs as a cycle and permit us to run the application as a compartment. Those machines can be actual machines or virtual machines running Linux or Windows OS. At the end of the day, the machine on which we introduce Docker becomes Docker Host, for instance, assuming we introduce Docker on our PC, that PC fills in as a Docker Host now and we can make Docker pictures, compartment, volumes, and organizations on that PC. It permits us to run numerous holders and gives separation among them. Every holder has its namespace, cgroup, network setup, and so forth
Any workstation on which we introduce Docker becomes Docker Host. It gives a stage on which Docker daemon runs. We then, at that point, run holders, construct pictures, volumes, organizations, and so on from Docker CLI. It is basic equipment.
As far as we might be concerned, is an actual machine or VM on which Docker daemon is introduced, we want the Docker client to communicate with the Docker daemon running. We can either introduce Docker CLI or Docker client on Docker Host or any unique far-off PC. At the point when we run any holder on the Docker Host utilizing Docker CLI, it gets executed as beneath:
1. As soon as we hit enter after typing the command, CLI makes a REST API call to docker daemon in JSON format.
2. Docker daemon checks for the Docker image that is mentioned in the command locally and if it does not find the image locally then it goes to the Docker registry and searches there, if it finds the image over there, it first pulls that image locally and then starts the container.
When we talk about containers it looks similar to VMs however the main difference is containers do not have a full-blown operating system. It uses Docker Host’s kernel to access the resources. Also, all the required binaries or libraries to run an application are encapsulated in an image called Docker image.
Given below shows the creation of windows docker host:
1. First, we have to download the installation package from hub.docker.com.
2. Go to this link and click on ‘Get Docker’.
3. Once you downloaded the installation package, double click on the package to execute it, click on Run when prompted.
5. Installation gets started as soon as we press the ‘Ok’ button.
6. Once the installation has been completed, we get the below window to restart the host.
7. After the restart, we see the shortcut ‘Docker Desktop’ and if we check the hidden icons, we can see services are getting started.
8. Now, open PowerShell and run the command as below:
Code:
docker --version
9. We can now create containers, images, volumes, etc. On this newly created Docker Host, however, we can manage this as well.
It is a standalone Docker remotely Host and it is good for testing purposes and development. In the production, we need to initialize swarm mode to use multiple Docker Host that creates Docker Swarm or cluster.
We will install Docker on Cent OS7 to make it Docker Host.
1. First, we need to install the below packages as device-mapper is the default storage driver for CentOS7 and earlier.
Code:
$sudo yum install -y device-mapper-persistent-data lvm2
In the above snapshot, we see that those packages are already installed.
2. Now, add the Docker repository using the below command.
Code:
$sudo yum-config-manager \
--add-repo \
3. Below is the command to install Docker CE i.e. Community Edition, Docker CLI i.e. Docker client to communicate with Docker daemon and contianerd.io.
Code:
$sudo yum install -y docker-ce-18.09.5 docker-ce-clip-18.09.5 containerd.io
4. After the installation, we must start the docker service and enable it so we do not have to start it if the server gets rebooted.
Code:
$sudo systemctl start docker
$sudo systemctl enable docker
5. In the end, we need to add the user who is going to execute the Docker commands to the ‘docker’ group otherwise we have to use ‘sudo’ in every command.
Code:
$docker version
$sudo docker version
6. Let’s add the user to the ‘docker’ group using the below command.
Code:
$sudo user-mode -a -G docker <user_name>
7. Now, run the docker commands without sudo.
Code:
$docker version
8. That’s it, we have successfully converted CentOS 7. Now, we can run all the docker commands.
Given below are the advantages mentioned:
It is only any uncovered metal server or VM running on any server or facilitated on the open cloud which has Docker daemon running on it. It alludes to a hub in a Docker multitude or bunch. We can't run windows holders like IIS server on Linux Docker Host anyway we can run windows compartments as well as Linux compartments on Windows Docker Host.