Docker Environment
- Amit Dhanik

- Sep 19, 2022
- 3 min read
This article is inspired by great learning, If you want to view the lecture, you can click here and enroll in the same.
Let's have a look at Docker Environment

cc: Great learning
Docker Engine
The Docker engine is the core part of docker and it helps with the creation and management of all the docker processes. It has three parts to it -
Docker CLI - command line interface which helps us to interact with docker and run all the basic commands in docker like docker ps, docker pull image, docker run, etc.
Docker API - The application program interface of docker is responsible for communicating all the requests from CLI to the Docker Daemon.
Docker Daemon - does all the processing and managing of all requests that are being sent via Docker API.
For eg - If you were a user, and you wanted to create an image, you type in the command via CLI, this request is communicated by the docker API to the docker daemon. The request is then processed by the docker daemon and we get a visual output for it. This is how the docker engine works.

cc: Great learning
Docker Objects
There are a variety of objects used by docker to fulfill the purpose of containerization. Let's study them one by one.

cc: Great learning
Docker images
Docker images, in layman's language, are a set of instructions for executing the code written along with its dependencies(libraries). At runtime, Docker images create containers.
To create a house first, you need a blueprint of that first. That blueprint is what is docker image. In the docker image, you mention the OS which is to be used, the port on which the container will be exposed, etc. The docker daemon creates the container once it receives the command via API server which is triggered once the user inputs the docker run command in CLI.
Here, we create a Ubuntu container, which is mentioned in the docker image instructions.
docker pull ubuntu

cc: Great learning
Docker Volumes
To store data, we make use of Volumes as containers cannot permanently store data by themselves. If the pod crashes, the container gets restarted as well. Hence to reserve the data stored on containers, we make use of these external storage devices(like a hard drive), hence volumes are used. Volumes are the persistent storage locations for containers. They can be easily attached and removed from containers. But what if we have to encrypt the external hard drive (volume) that we have attached?
To help enhance the abilities of volume, we make use of Volume drivers. Volume drivers are used for creating persistent storage on other hosts, clouds, and help in encrypting Volumes.

cc: Great Learning
Docker Network
Docker Network helps us in the connection between one or more containers. If you have a set of 3 containers that make up one application, to enable the connection between these 3 containers, we make use of docker Networks.

Docker registry
It's a location where all the docker images are stored. The developer creates the image and pushes it to the docker registry where it is made available for everyone. The tester pulls the image on his own system, runs the image, creates a container from it, and is able to test it. You can version your images as well.
Docker Hub is an example of a Docker registry from where you can push and pull your images easily.

Good to read, Top 20 Dockerfile best practices https://sysdig.com/blog/dockerfile-best-practices/
Hope you enjoyed reading.






Comments