Now that I've started learning Docker, what is Docker? I briefly summarized that. I would appreciate it if you could point out any mistakes.
--For creating, executing, and managing container-type virtual environments.
--For example, if you want to use Rails, you can run it quickly by launching a container with Rails installed.
――You can easily create the same environment even in different environments, and the environment will not change depending on the person.
--Set the development environment to Docker. --Can be used in verification environment and production environment. --Manage Docker images in the Docker repository. --Building web servers, database servers, etc.
The verification environment is almost the same as the production environment, but it refers to the environment for the purpose of testing. The production environment is the environment actually used by the user.
=> The current state can be shared and distributed to the production environment and verification environment at any time. --You can quickly set up the program execution environment. --The same environment can be shared among project members. --Since the package is not installed directly on the PC, the PC environment is not polluted.
=> Since it is managed in a container, it is easy to manage what is installed.
--Run a hypervisor on the host OS to run a virtual machine. A hypervisor is software that controls the CPU, memory, hardware, etc. used by the guest OS.
=> Overhead increases in terms of resources. --Bugs may occur due to differences in the environment. --Since the isolation level between virtual machines is high, it is strong in security and does not easily affect other machines.
--There is no guest OS in the container, and the kernel of the host OS is used.
=> Light and fast because it uses less resources. --Since it is summarized in Docker Image, it works in the same way even if the environment changes. --Since the isolation level is lower than that of hosted virtualization, it is necessary to take measures (such as not including useless packages) to prevent attacks.
% docker run ~~
*** The Docker run command can execute the following three commands at once. *** ***
docker pullimage acquisition
docker startcontainer start
By using the Docker run command, you can search for an image from Docker Hub, acquire it, create a container, and start it.
A Docker Image is a collection of files used to run a container. You can reproduce the environment such as nginx by starting the image. In object thinking, *** images are classes and containers are like instances ***.
*** * nginx is a type of web server. Only static content is taken out and dynamic content is left to the server by the application. *** *** *** * Static content is a file that does not change with each request, such as CSS and image files. *** ***
--The Docker image has a layered structure.
--The Docker container should be lightweight and small in size.
=> Don't put useless files in the image. The lighter the weight, the faster the startup. --When you build a container from a Docker image, the layer pulled from the image is used for reading, and you can write positively from there. The place that can be described with this plus is called the container layer.
--You can create an execution environment by inheriting the Docker image. (Adding functions) --As a merit of inheritance, if you have the same layer, you only need one, and you can share and use it. Therefore, communication volume and storage are saved.
You can also create your own image. It can be executed by writing in the Dockerfile and building the image.
FROM image name:TAG name #image Determine the image that will be the basis for creating the image. You can also specify TAG, but if you do not specify it, it will be the latest tag. RUN ~~ -y #Install or update new packages.-There is a y option, etc., and by adding it, everything will be set to YES and the process will not stop. CMD ~~ #A command to execute after the container is created.
――Docker is a container that can handle virtual technology. The merit is that it can be executed by just typing a few lines, and it can be managed by code, so it is easy to share and distribute. --The important concepts in Docker are images and containers. ――The reason for using it is that it has the merits of portability (portability), overhead (uses less resources), and Immutable Infrastructure (immutable). ――Docker can create an environment in one process, so it doesn't take much time. A process is the number of programs that run. --Can be treated as immutable. Because we have achieved something that works reliably with snapshots. A snapshot is a cut-out of that moment. --Since the kernel of the host OS is used, the capacity is small and the startup is quick. ――Docker has many merits, but the isolation level is lower than the conventional one in terms of security, so it is better to take measures to prevent attacks (do not install useless packages or vulnerable packages). (Of course, necessary measures not limited to Docker)
This article was written with reference to the following information.