Docker introduction I


Resource Center and tools

Help developers work more efficiently and provide tools and resources around the whole life cycle of developers…

Docker is an open source application container engine, based on go language and following Apache 2.0 protocol

Docker engine is a client service program that contains the following main components (flow chart of docker engine)
Docker introduction I

It is a kind of server. It is a long-running program called daemon. Rest API is used to specify the interface that the program can use to communicate with the daemon and indicate what it can do. It is the client of a command-line interface (CLI) tool.

Docker features:

Easy and fast configuration:

This is a major function of docker, which can help us configure the system easily and quickly, and deploy code in less time and effort. Because docker can be used in various environments, the infrastructure is no longer required to be associated with the environment of the application

Improve work efficiency:

By relaxing the technical configuration and rapid deployment of applications, there is no doubt that it saves time and improves productivity. Docker not only helps to execute applications in isolated environments (each application is a separate environment, and each environment has an independent OS System), but also reduces resources

Application isolation:

Docker provides containers for running applications in an isolated environment. Each container is independent of another container and allows any type of application (because there is a separate OS mechanism at the bottom of each container)

Cloud call

It is a tool for clustering and scheduling of docker container. Swarm uses docker API as its front end, which helps us to use what tools to control it. It can also control the docker host cluster to a virtual host. This is a self-organizing engine group for enabling pluggable back end. Swarm is used to manage the cluster

Lu Youwang

It can be used to route incoming requests from the published end on the node to the active container. Even if there are no tasks running on the node, this function can also realize the link (there is a network for communication between containers)


The service value allows the execution of the task list of the cluster content container state. Each task represents an instance of the container that should run, and swarm schedules between nodes

security management

It allows you to save confidential data to the swarm, and then choose to give the service access to some confidential data. It contains some important commands to the engine, such as confidential data, creation of confidential data, etc

Docker is a CS mode (client server) that uses remote APIs to manage and create docker containers

Docker containers are created through docker images

The relationship between container and image is similar to that between class and object in object-oriented programming
Docker introduction I

There is no container until there is an image. We operate on the container side through the API

Docker introduction I

When the docker is used to create the image in the local warehouse, the docker can be used to create the image. If the docker does not exist in the local warehouse, the docker can be used to create the image. In this case, the docker can be used to create the image directly,

What is a data volume

A data volume is a special directory that can be used by one or more containers.

The achievable goal is to bypass the “copy write” system and reach the performance of local disk IO (for example, running a container and modifying the data in the container will directly change the content of the data volume on the host, so the performance of local disk IO is not to write a copy in the container first and then copy the modified content in the container for synchronization)

Bypassing the “copy write” system, some files do not need to be packaged into the image file in docker commit

Share directories across multiple containers

Share directories between host and container

Share a file in the host and container

Creation of data volume:

Method 1: specify the directory of volume in dockerfile, such as volume / var / lib / test

Method 2: add – V docker run – D – P – V / webapp training / webapp Python app to the docker run command py

This article is transferred…

This work adoptsCC agreement, reprint must indicate the author and the link to this article