How to work Docker Hosts?

 How to work Docker Hosts?
Techiio-author
Written by Nilima PaulFebruary 18, 2022
10 min read
Docker
2 VIEWS 0 LIKES 0 DISLIKES SHARE
0 LIKES 0 DISLIKES 2 VIEWS SHARE
Techiio-author
Nilima Paul

Technology Security Analyst

We will discuss How to work Docker Hosts.

Introduction to Docker Hosts:

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

How do Hosts work in Docker:

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.

Creation of Windows Docker Host:

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.

Creation of Linux Docker Host:

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.

Benefits of Docker Hosts:

Given below are the advantages mentioned:

  • We can undoubtedly change over our ordinary PC as a Docker Host to run docker orders for testing or advancement purposes.
  • It is free of OS and stage which implies we can make a running Windows, Linux, or Mac, and from ordinary PC to VM facilitated on open mists like AWS, Azure, GCP, or any open cloud climate.
  • It gives separation between holders which implies compartments don't know about different compartments on a similar host.
  • It gives better asset usage when contrasted with VM.
  • Assuming an application is running as a holder, it gives us ensures that it will run the very same on others also with no mistake.

Conclusion:

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.

Docker
Docker Hosts
DevOps
Docker file
Containers
2 VIEWS 0 LIKES 0 DISLIKES SHARE
0 LIKES 0 DISLIKES 2 VIEWS SHARE
Was this blog helpful?
techiio-price-plantechiio-price-plantechiio-price-plantechiio-price-plantechiio-price-plan
You must be Logged in to comment
Code Block
Techiio-logo

Techiio is on the journey to build an ocean of technical knowledge, scouring the emerging stars in process and proffering them to the corporate world.

Follow us on:

Subscribe to get latest updates

You can unsubscribe anytime from getting updates from us
Developed and maintained by Wikiance
Developed and maintained by Wikiance