[LINUX] Why Docker is so popular. What is Docker in the first place? How to use

Introduction

This article is for beginners of Docker to learn the basic contents.

What is Docker

Docker is one type of virtualization and is called container-type virtualization. Container-type virtualization allows you to deploy a virtual OS on the OS by creating a virtual space called a "container" on the OS, and further divide (isolate) the process execution space.

Differences and advantages from virtualized servers

--Fast startup speed --Moveable --Light operation --Resources can be used effectively

Why Docker is attracting attention

The main reason is that you can move and make effective use of resources. Since the efficiency of the server can be improved by actively replacing unused computer resources, it is compatible with cloud services and other variable costs. Google puts all the software in a container and uses it while actively replacing it to improve the efficiency of the server.

In the past, when creating any service, engineers were severely constrained by the environment. I had to develop while worrying that the code I wrote would really work on the server. However, by using Docker, by developing while running the container on docker such as your own PC, you can finish the code and finally move the container to make the application work. For this reason, Docker is not limited to the skills of infrastructure engineers. → It is said to be a required subject for programmers.

Flow of using Docker

1 Docker installation -Install Docker on the OS. Can be installed on mac, Windows and Linux. 2 Creating a Dockerfile -Dockerfile is a text file that determines the procedure for creating a completely new Docker Image. Therefore, it is not necessary if you do not create a completely new Docker Image, such as when fetching from the Internet. 3 Creating a Docker Image -Create a container image by bringing it from any location. In the initial stage after installing Docker, the container image does not exist, so bring it from the Internet by command input. -There is a place called "Docker Hub" as a general image storage location on the Internet. In addition, AWS ECR is built, stored and managed on a repository server unique to various companies. 4 Container startup

Actual command input

・ Get an image from the internet

$ docker pull [Image name]

You can also find commands that you can copy and paste by creating an account in Docker Hub and searching for the service name. Copy and paste to pull this image. image.png

Example) Apache image acquisition


$ docker pull httpd

・ Check if the image was taken


$ docker images

・ Start docker → About options ① -d Run docker in the background ② Specify the -p port. [8088: 80] is the relationship of [Host port: Container port]. It means that port 80 of the container is listened to at 8088 on the host side.

$ docker run -d -p 8088:80 httpd

・ See the status of the container → You can see the items of container ID and STUTAS.

$ docker ps -a

・ Container stop

$ docker stop [Container ID]

-Delete the container itself

$ docker rm [Container ID]

-Delete image

$ docker rmi [Container ID]

in conclusion

This time, I summarized the basic knowledge of Docker. Applications include creating Dockerfiles, managing multiple containers using docker-composer, and managing resources for multiple Dockers using orchestration tools.

Recommended Posts

Why Docker is so popular. What is Docker in the first place? How to use
[Pandas] What is set_option [How to use]
How to give and what the constraints option in scipy.optimize.minimize is
How to use the asterisk (*) in Python. Maybe this is all? ..
How to use is and == in Python
How to use the C library in Python
How to use MkDocs for the first time
What is wheezy in the Docker Python image?
Linux is something like that in the first place
How to use the exists clause in Django's queryset
How to use the model learned in Lobe in Python
How to use the generator
How to use the decorator
I want to make the LED Lighting of ErgoDox EZ shine, but tell me what the LED is in the first place
How to use the __call__ method in a Python class
Notes on how to use marshmallow in the schema library
Why django-import-export import is so slow and what to do
What to do if the image is not displayed using matplotlib etc. in the Docker container
How to use the optparse module
How to use SQLite in Python
How to use Mysql in python
How to use ChemSpider in Python
How to use PubChem in Python
How to use the ConfigParser module
How to log in to Docker + NGINX
How to judge that the cross key is input in Python3
[Introduction to Python] How to use the in operator in a for statement?
What to do if you can't use the trash in Lubuntu 18.04.
How to use the render function defined in .mako (.html) directly in mako
What to do when the value type is ambiguous in Python?
[Python] What is pip? Explain the command list and how to use it with actual examples
How to use calculated columns in CASTable
How to use the Spark ML pipeline
[Python] What is a formal argument? How to set the initial value
What to do when the result downloaded via scrapy is in English
How to use Google Test in C
How to use the Linux grep command
What is "mahjong" in the Python library? ??
How to write what to do when an application is first displayed in Qt for Python with Designer
How to use Anaconda interpreter in PyCharm
How to use __slots__ in Python class
How to use tensorflow under docker environment
How to use the IPython debugger (ipdb)
How to use regular expressions in Python
What to do when the warning "The environment is in consistent ..." appears in the Anaconda environment
How to use Map in Android ViewPager
What is the fastest way to create a reverse dictionary in python?
Tips for those who are wondering how to use is and == in Python
The first step to log analysis (how to format and put log data in Pandas)
How to use Python Image Library in python3 series
[Introduction to AWS] The first Lambda is Transcribe ♪
How to reflect ImageField in Django + Docker (pillow)
How to use the graph drawing library Bokeh
Summary of how to use MNIST in Python
How to use the Google Cloud Translation API
How to use the NHK program guide API
[Algorithm x Python] How to use the list
How to get the files in the [Python] folder
How to use tkinter with python in pyenv
Use pygogo to get the log in json.
[Introduction to statistics] What kind of distribution is the t distribution, chi-square distribution, and F distribution? A little summary of how to use [python]