[LINUX] I will summarize what I was happy to do to get out of the state where I do not know the letter D of Docker

Overview

When I was touching Docker, I often got stuck in what I should study, so I will try to organize what I thought was particularly useful while studying with a memorandum.

Target audience

It's good to get started with Docker, but I don't understand infrastructure or Linux at all, but the focus is on the level of wanting to do something about it. Deep parts such as stepping into k8s and best practices for mastering Docker in practice are excluded. Rather, I would like to read if there is such a thing.

In addition, this article focuses on the knowledge necessary to be able to build a web application execution environment with Docker. Therefore, if you have experience in creating simple web applications that use databases, you may be motivated to study Docker.

Preface

About a year ago, I suddenly thought that I should do ** Docker **. Docker has a lot of introductory articles, and I went quickly to the point where I could not move it for the time being by imitating it. However, at that time, I had no knowledge of Linux or infrastructure, so it was unclear what I was doing, let alone the principle of operation, and I couldn't get my hands on it from the beginning.

There were many introductory articles about Docker itself, but I couldn't find a complete picture of what knowledge you need to understand Docker. I thought that Docker was still early for me, but I wanted to be able to understand Docker after all, and I was studying by doing various things.

It is still far from a state where Docker is completely understood, but I wondered if I was able to reinforce the prerequisite knowledge necessary for understanding the basic part, and I managed to escape from the state where I could not imagine the operation of Docker at all ... must.


Although I could barely get out of the state where I didn't understand Docker, I didn't know what to do to get rid of Docker's weakness, and it was difficult for me to continue groping. So, if I have a memorandum, I would like to summarize what I thought was good to do this. If you do this, Docker is perfect !! ... it's not like that, but I hope it helps.

In the following, we will mainly introduce books. At this time, it may be good to be aware of what you aim to learn for each. I don't know if it will serve as a guide, but in addition to introducing what I was happy with, I will also describe what I was aiming to learn.

Linux

Understanding Linux is essential for learning how Docker works, not to mention operations inside the container. However, even if you look at Linux alone, the content to study is very wide, and it is easy to worry about what to start with. Below are some books that have helped you understand the basic commands, operations inside the container, and the working principles of Docker.

New Linux textbook

Originally, I had a lot of opportunities to work with Linux, but this was the first time I had learned a lot from books. In conclusion, I think the first thing I started with this book was the correct answer. It's very easy to read because it starts with a shell and introduces commands that were used in the atmosphere in a way that carefully accumulates knowledge one by one.

In most cases, operating inside a container requires Linux shell operation as a prerequisite. If you start from here, you won't know what to do when you enter the container, and you won't have to worry about it. The basics of Linux are tightly packed, so I would like to continue reading it regularly.


Linux server construction and operation guide starting from scratch How to make a Web server to learn while running

One of the benefits of learning Docker is that it makes it easier to build an environment. Only when you realize this will you be more motivated to learn Docker.

So, when I got used to the shell operation, I actually tried to build the environment while moving my hands based on the book. In today's world, you can build a server at low cost by using VPS or cloud services. After studying, I think it's a good idea to actually build it as a server instead of a container. If you are concerned about security, you may want to try using a VM.

This book is structured so that you can learn how to create a LAMP environment while reinforcing the knowledge necessary for building a server. In the meantime, there is a story about networks, which is also explained, but if you get stuck, it may not be painful if you study networks first and then try again.


Try and understand how Linux works-Basic knowledge of OS and hardware learned through experiments and illustrations

Docker shares kernel

As the word says, understanding the kernel is important to getting to know Docker in depth. However, in order to understand the kernel, deep knowledge and experience in a wide range of fields are required. If you want to learn the kernel well, you have to be prepared to face difficult and thick books, but if you are at the stage of getting started with Docker, I think that one such introductory book is enough, I'm sure. ...

A little off the beaten track, this book explains difficult concepts in an easy-to-understand manner with a wealth of diagrams. Even if you get lost a little in the text, it will be immediately supplemented with a diagram to reinforce the image, so it will prevent you from retiring in the middle, which is common in difficult books.

Furthermore, you can learn not only illustrations but also process management and memory management by connecting images with the code by actually using sample code written in C language. This connection is time consuming, but it deepens your understanding to a level that cannot be obtained by just following the letter.

After actually reading this book, it became much easier to imagine the operating principle of Docker. The difficulty level will increase steadily from around memory management, but I think it is well worth the effort.


network

When dealing with Docker, it was difficult to grasp the image of inter-container communication, and at the beginning it was difficult to understand. At that time, I had very little knowledge about networks, and I had few opportunities to get involved in business, so I personally feel that this is the most stumbling block.

Not to mention the network itself, the scope of study is very wide. However, if your goal is to understand Docker's network, it may be easier to focus on Layer 2 and Layer 3.

[3-minute network basic course](https://www.amazon.co.jp/%E6%94%B9%E8%A8%82%E6%96%B0%E7%89%88-3%E5%88 % 86% E9% 96% 93% E3% 83% 8D% E3% 83% 83% E3% 83% 88% E3% 83% AF% E3% 83% BC% E3% 82% AF% E5% 9F% BA % E7% A4% 8E% E8% AC% 9B% E5% BA% A7-% E7% B6% B2% E9% 87% 8E-% E8% A1% 9B% E4% BA% 8C / dp / 4774143731)

This is a book version of what is published on the website. Focusing on layers 1 to 3, various terms are written interactively with figures. When I was reading network-related books, the layers around here had few opportunities to touch my work and hobbies, and I had a hard time getting an overview. Especially in the early days, it was often confusing to explain with deeper stories such as Ethernet standards and physics.

On the other hand, this book is not too deep and not too shallow, and each term is written in just the right amount of salt plum, so it is recommended as a first step. The amount of sentences can be read quickly, so you may want to read it several times to get used to network-related terms. Also, the website version has various differences from the book version, so please take a look if you are interested.

Packet capture textbook

For example, in the case of a program, after learning grammar, by actually writing the source code, you can establish the knowledge through experience. However, when it comes to networks, the path to seeing and manipulating actual communications is not as informative as when writing a program.

Meanwhile, by encountering this book, my weakness in networks became a little better. The composition itself explains each layer that is common, but after all, it explains in detail the actual state of the packet for each layer, including a diagram that carefully describes the flow. Thank you. Rough knowledge of each layer is a prerequisite, but repeated reading should take your network knowledge one step further from the textbook stage.

Also, when using Docker as a production server, knowledge other than layers 1 to 3 such as HTTPS support and DNS is required, so if you read it back each time, you may be able to learn smoothly when applying.

Introduction to TCP / IP network while running on Linux

It's a recently published book, but it was very interesting to read, so I'll introduce it here. In Docker, I often see the explanation that you can set up a virtual network by using what is called a network namespace, but in reality, this alone does not come to a pinch.

In this book, not only actually creating a virtual network with a network namespace, but also Ethernet and IP communication are explained carefully from the point of setting the network interface.

For each TCP / IP layer, you can build the settings and interfaces required for communication with the network namespace, and while checking the actual communication with tcpdump, you can see step by step until communication becomes possible. .. If you learn the basics of Linux, read the network books listed above, and then work on it, you will learn more about the process of enabling computers to communicate with each other via networks.

Also, by actually setting the interface with the network namespace, I think that the understanding of Docker around the network will be further improved.


(Digression) Speaking of introductory books on networks, "Why networks are connected" and "Introduction to mastering TCP / IP" are listed as standard. These books are certainly easy to understand, but if you try with little knowledge of networks, you will have a lot of trouble. (I had a hard time entering from here)

First of all, read the introductory book mentioned above, and when you actually need network-related knowledge in some way, I think that you can fully enjoy it if you try it.

Docker

Of course, to learn how to use Docker, you also need to study Docker itself. There are many excellent Docker introductory information on the net, including Qiita. You can get a feel for the atmosphere by searching for Docker Primer and touching some of the things that look good. At this time, it is not just reading, but actually moving your hands, trying to write a Dockerfile, using Docker Compose, trying various things, failing, succeeding, etc. It is important.

At first, I don't get an idea of why each command and setting description is necessary, so I think it will be difficult. However, if you have acquired the basic knowledge from the items mentioned above, it should not mean that you do not have enough prerequisite knowledge and you cannot get out of your hands or feet, so you should be able to understand it little by little.

Here are some of the things I've been working on, so if you're wondering what to start with, you might want to try them out if you have exercises.

At this time, most of them have already been released as useful images, but at first, if you also study and build your favorite Linux distribution as a base image, you will deepen your understanding. think.


However, I would like to use books for systematic learning. Below are some of the best Docker introductory books I've read.

Docker understood by manga

There are 3 volumes in total, but at the introductory stage, I think that 1 or 2 volumes are enough. Since the terms of Docker are explained in a cartoon format, even if you know the meaning of words such as "image" and "container", it is suitable for getting out of the state that is hard to imagine in your head. If you read it together with the introductory articles on the net, you will get a good understanding as a first step.

Docker Deep Dive

It's an English book, so it may seem difficult at first glance, but it doesn't use difficult English words or expressions, so if you're not too bad at English, please read it. Various elements of Docker are explained in chapters in the form of "overview", "detailed explanation", and "command", and the difficulty level does not suddenly jump up in one chapter, so you can surely learn step by step.

If you read it after moving your hands to some extent, you should be able to get out of the "Docker I don't understand" state by connecting the knowledge that was scattered in pieces with clear chapters. To understand the contents firmly, you need a wide range of knowledge such as Linux and networks, but if you accumulate the things introduced so far, you will surely be able to face it.

Other

It's a little different from the understanding of Docker itself, but here are some of the things I'm glad I did.

Vim

Vim Masterclass

When you enter the container and operate the configuration file for a while, you can do this from the host or use the extension function of the editor. However, it would be very convenient if there was a tool that could be operated quickly in such cases. At such times, studying Vim will make you feel comfortable in the container.

Vim itself is hotly talked about everywhere, so I won't go into details. If you don't want to customize it with extensions, studying in the Udemy course above will help you understand how to use it easily in a matter of hours. Although it is in English, it also has a subtitle function, and above all, the exercises are made in a form that is just right for learning the basic operations of Vim, so you will be able to learn the goodness of Vim without getting tired.

Git

Introduction to how to use Git to learn with Wakaba

[Git textbook for engineers [advanced edition] Understanding the internal mechanism of Git](https://www.amazon.co.jp/%E3%82%A8%E3%83%B3%E3%82% B8% E3% 83% 8B% E3% 82% A2% E3% 81% AE% E3% 81% 9F% E3% 82% 81% E3% 81% AEGit% E3% 81% AE% E6% 95% 99% E7% A7% 91% E6% 9B% B8% EF% BC% BB% E4% B8% 8A% E7% B4% 9A% E7% B7% A8% EF% BC% BD-Git% E5% 86% 85% E9% 83% A8% E3% 81% AE% E4% BB% 95% E7% B5% 84% E3% 81% BF% E3% 82% 92% E7% 90% 86% E8% A7% A3% E3% 81% 99% E3% 82% 8B-% E6% B2% B3% E6% 9D% 91% E8% 81% 96% E6% 82% 9F-ebook / dp / B01AAIN85K)

I think you can understand Docker without knowing Git itself. However, since the source code of the application managed in the environment built with Docker will be managed with basic Git, there is no loss in learning together.

Git has a lot of wonderful things besides the books listed here as well as online, so I think that you will not get lost.


Summary

When I started writing with a little arrangement or a light feeling, it became longer than I expected. If you want to use Docker as a mere tool, you can do it by memorizing that you can hit this command without doing this, and using the nice image provided. ..

However, personally, I think it is better to learn from the basics and pursue ** why **, even if it is a little detour.

This isn't as good or bad, just because it's more fun. With Docker as a starting point, I started to reach out to networks and Linux, and more than a year ago, I became more fond of Docker, infrastructure, and Linux. The more you like and the more you learn from it, the more intellectual curiosity you get, which is fun.

I will omit it because writing more than this will derail, but I hope this article will help you to learn even a little fun.

Recommended Posts

I will summarize what I was happy to do to get out of the state where I do not know the letter D of Docker
What to do when you get "I can't see the site !!!!"
I want to get the path of the directory where the running file is stored.
Example of what to do when the sample script does not work (OpenCV-Python)
I want to visualize the transfer status of the 2020 J League, what should I do?
I was in trouble because the behavior of docker container did not change
What to do when is not in the sudoers file.This incident will be reported.
real-time-Personal-estimation (What should I do to prevent the estimation of images outside the category) * Failure.
It was a little difficult to do flask with the docker version of nginx-unit
I tried to summarize the basic form of GPLVM
Get to know the feelings of gradient boosting trees
I tried to summarize the string operations of Python
What to do if the image is not displayed using matplotlib etc. in the Docker container
I was in charge of maintaining the Fabric script, but I don't know.> <To those who
I tried to get the location information of Odakyu Bus
I want to get the operation information of yahoo route
[Machine learning] I tried to summarize the theory of Adaboost
I want to know the features of Python and pip
Keras I want to get the output of any layer !!
I want to know the legend of the IT technology world