Docker official tutorial notes (1) getting started

0. Preface

  • Tutorial link
  • This article mainly includes
    • Basic concepts of Docker: What is Docker and what it can do
    • The composition of Docker: from the perspective of program implementation, from the perspective of user use

1. Docker basic concepts

1.1. What is Docker

  • Docke is mainly used for the development, migration, and operation of the application environment.
  • Docker can make different applications have different environments, facilitating development and deployment.
  • The most helpful explanation for me is:
    • When publishing, not only publish the program, but also publish the environment.

1.2. What can Docker do

  • Provides a "container" function
    • Different programs provide different environments, and each environment is a "container"
    • The word "container" is a good reflection of the isolation between multiple environments
    • The function provided by the container is similar to a "virtual machine", which can be understood as a "lightweight" virtual machine. I don't understand the specific details, and I don't plan to take a closer look.
  • Why should I learn Docker (Docker in the daily work of algorithm engineers)
    • When multiple people use the same server, if you need to use different cuda versions, it will be very troublesome. Although conda provides cuda in different environments, there are still problems.
    • In fact, the installation of various software is really a difficult problem, such as different versions of opencv...

2. Docker composition

2.1. Docker Engine

  • From the perspective of program implementation, Docker layering is shown in the following figure (official picture)

img

  • Server: long-running daemon, other
  • REST API: defines the interface to communicate with the daemon.
  • Client (docker CLI): A command line tool that calls the REST API.
  • Objects:container、image、network、data volumes

2.2. Docker architecture

  • From the perspective of usage, Docker is divided into the following parts (official pictures)

[External link image transfer failed. The source site may have an anti-leech link mechanism. It is recommended to save the image and upload it directly (img-SYzEjBha-1610864978881)(https://zhangyiyang-blog.oss-cn-hangzhou.aliyuncs.com/20210116223209) .svg)]

  • Several of the main components are introduced as follows
    • Client: A user tool that controls the various Objects by communicating with the Docker daemon
    • Docker Host
      • Docker daemon: the daemon, the client communicates with the daemon to achieve the purpose of controlling containers and mirroring.
      • Containers and mirrors: introduced later
    • Registry: mirror warehouse
  • Mirror and container are introduced separately
    • Recommend a look at this blog
    • Mirror:
      • The Docker image is read only in
      • Mirrors in Docker generally have a hierarchical structure, that is, a mirror generally depends on a series of other mirrors
      • We can get the existing image directly from the mirror warehouse, or we can create it ourselves through Dockerfile.
      • Each line of the Dockerfile will create a mirror. When the same Dockerfile is run repeatedly, only the modified line will be rerun.
    • container:
      • Runnable containers, you can create, start, stop, move, and delete a container.
      • By default, each container is independent of each other.
      • A container is composed of corresponding images and related configuration information. After the container is deleted, its related configuration will be deleted.
      • The container probably adds a read-write layer on top of the mirror layer (read-only layer).

3. Other

  • docker run Command examples, see in detail later, don't care now.

  • The official tutorial also introduces the underlying technology, I don’t care, I didn’t take a closer look.

Guess you like

Origin blog.csdn.net/irving512/article/details/112743919