What is Docker? I tried to summarize


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.

Docker concept

--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.

Docker usage example

--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.

Benefits of using Docker

=> 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.

Differences between hosted virtualization and container-based virtualization

Hosted virtualization

--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.

Container virtualization

--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 command


% docker run ~~

*** The Docker run command can execute the following three commands at once. *** ***

  1. docker pull image acquisition
  2. Create a docker create container
  3. docker start container start

By using the Docker run command, you can search for an image from Docker Hub, acquire it, create a container, and start it.

What is an image?

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. *** ***

Docker image structure

--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.

Docker image inheritance

--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.

The following usage example
* ~~ is a temporary one. Try what you like for yourself.


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.

-Building an application execution environment with Docker starting from scratch -Introduction Docker

Recommended Posts

What is Docker? I tried to summarize
I tried to summarize the state transition of docker
I tried to summarize iOS 14 support
I tried to summarize Java learning (1)
I tried to summarize Java 8 now
What is Docker?
What is Docker
What is Docker
I tried to summarize the methods used
I tried to summarize Java lambda expressions
I tried to summarize the Stream API
I tried to summarize about JVM / garbage collection
I tried to verify AdoptOpenJDK 11 (11.0.2) with Docker image
[Must see !!!] I tried to summarize object orientation!
[Introduction to Java] I tried to summarize the knowledge that I think is essential
I tried what I wanted to try with Stream softly.
What is docker run -it?
I tried to make FizzBuzz that is uselessly flexible
I tried to summarize various link_to used this time
Rails6 I tried to introduce Docker to an existing application
I tried BIND with Docker
I tried to verify yum-cron
Introduction to Ratpack (1) --What is Ratpack?
I tried to find out what changed in Java 9
I tried to build an environment using Docker (beginner)
I tried to make an introduction to PHP + MySQL with Docker
I tried to summarize the basics of kotlin and java
I tried to summarize the basic grammar of Ruby briefly
I tried to create React.js × TypeScript × Material-UI on docker environment
I tried to build the environment little by little using docker
I tried to summarize personally useful apps and development tools (development tools)
I tried to build the environment of WSL2 + Docker + VSCode
I tried to summarize personally useful apps and development tools (Apps)
I tried to create a padrino development environment with Docker
I tried to summarize object orientation in my own way.
I tried to chew C # (indexer)
I tried to interact with Java
I tried to understand nil guard
I tried to chew C # (polymorphism: polymorphism)
I tried to explain Active Hash
[Rails 6.0, Docker] I tried to summarize the Docker environment construction and commands necessary to create a portfolio
I tried to summarize the words that I often see in docker-compose.yml
I tried to integrate Docker and Maven / Netbean nicely using Jib
I tried to build the environment of PlantUML Server with Docker
[Ruby] Tonight, I tried to summarize the loop processing [times, break ...]
Special Lecture on Multi-Scale Simulation: I tried to summarize the 5th
I tried to understand how the rails method "redirect_to" is defined
Special Lecture on Multi-Scale Simulation: I tried to summarize the 8th
I tried to summarize the methods of Java String and StringBuilder
I tried to make Numeron which is not good in Ruby
I tried to build a laravel operating environment while remembering Docker
Special Lecture on Multi-Scale Simulation: I tried to summarize the 7th
I tried to introduce CircleCI 2.0 to Rails app
I tried running Docker on Windows Server 2019
I tried to get started with WebAssembly
I tried using Scalar DL with Docker
I tried to solve AOJ's Binary Search
What is Docker? What purpose is it used for?
I tried to implement the Iterator pattern
Microservices 101-I tried putting Docker on Ubuntu-
I tried to build AdoptOpenjdk 11 on CentOS 7