Technical memorandum (Docker)

This is an article post to keep a record of your own learning and to quickly remember it when you review it.

Entry date: November 15, 2020

This time I will keep a record about "Docker". horizontal-logo-monochromatic-white.png

Let's write it.

――――――――――――――――――――――――――――――――――――――

  1. What is Docker?

It's like an emulator that can run Switch and Linux on a PC. It is a platform for creating a virtual environment for creating and starting another machine in a PC.

―――――――――――――――――――――――――――――――――――――― 2. Why install Docker in the first place?

(1) To unify different development environments depending on the engineer and improve development efficiency = You will be worried about the difference in environment depending on the OS and the behavior depending on the machine you are using.

(2) Eliminate the difference between the development environment and the production environment as much as possible = Easy to deploy to production environment (Isn't the environment difference completely eliminated?) = Since there is no need to set the environment on the server, the release speed will be faster.

In other words, if you use Docker, you can unify the development environment for team development and You can minimize errors when deploying to the production environment!

―――――――――――――――――――――――――――――――――――――― 3. How does Docker work?

Docker is basically an image and a container. Create a container from the image.

[What is an image] The template from which the container is based. A collection of OS, applications to be executed, and various settings (template).

【container】 Created based on the above image. Execution environment where the OS and applications run. By deploying the container in the production environment, you can run the application in the production environment.

Basically, Docker is basically composed of the above two.

―――――――――――――――――――――――――――――――――――――― 4. What are the specific operating procedures?

① Get / build the image ❶ Get an image from the Docker registry on the online Docker Hub. ❷ Create by yourself * Get the base image from the registry and build it with the settings added Build = base image with your own processing

In normal development, it is more common to create a Dockerfile yourself.

② Create and start a container

Create a container from the created image → and start it → The application works

――――――――――――――――――――――――――――――――――――――

The above is the basic flow.

However, in application development, work is usually done by dealing with multiple containers, so It is troublesome to build an image and create a container one by one.

So what if you want to run multiple containers?

Conclusion Use "Docker Compose"

Docker Compose is a tool for defining and running multiple containers. By describing the settings in the yml file, you can create and start containers with commands!

Here, the basic operation of the command in Docker Compose is described.

Build $ docker-compose build Generation start $ docker-compose up Stop $ docker-compose stop Deleted $ docker-compose rm Reboot $ docker-compose restart Stop delete $ docker-compose down

Other commands

Execute the command in the running container $ docker-compose exec Display a list of containers $ docker-compose ps Log display $ docker-compose logs Delete unused containers and images $ docker-compose prune

There are many others, but please refer to the reference in that case.

Reference URL: https://docs.docker.com/reference/

――――――――――――――――――――――――――――――――――――――

  1. Install Docker

Download it from get-started on the official website. Install the one for Desktop, I think it's a good idea to check your OS version in advance.

URL:https://www.docker.com/

When the download is completed and the application is executed, in the upper right corner of the desktop, A Docker whale icon will appear. (cute) You will be able to operate the application when you click it and it is in the running state.

――――――――――――――――――――――――――――――――――――――

  1. How to start a container with Docker

Official documentation: https://docs.docker.com/

Is it installed on the PC with "Quickstart" which has no official document? You can easily check the operation, so it is recommended to do it as a touch while referring to it.

――――――――――――――――――――――――――――――――――――――

It's easy, but that's it. As an impression, it has been adopted by modern WEB companies, Looking at the merits of the introduction, I thought, "Oh, I see."

A sense of speed is important in advancing WEB development, It costs money to move people, so Docker is rational to take advantage of them quickly I thought it was a great platform.

In advancing learning, if there are additional items, write a separate article or I would like to make it possible to enrich the content by adding it here.

Thank you for visiting.

Recommended Posts

Technical memorandum (Docker)
Docker memorandum
Docker memorandum
Memorandum docker command
Docker command memorandum
Docker Machine (personal memorandum)
Docker network (personal memorandum)
memorandum
memorandum
docker
docker memo
kubernetes + docker
spring × docker
About Docker
Launch docker container on EC2 (personal memorandum)
MyBatis memorandum
Docker Intellij
Java memorandum
Docker basics
Rails memorandum
Error memorandum
Jaba Jaba Memorandum
Docker installation
JavaFx memorandum
About Docker
Docker command
JAVA memorandum
JUnit memorandum
Gradle Memorandum
Understand Docker
thymeleaf memorandum
Building a CICD pipeline using Docker (personal memorandum)
Data management using volume in Docker (personal memorandum)