Tools | Docker basic concepts Summary

▍ What is the Docker?

Docker is an open source application container engine that lets developers can package their applications and dependencies into a portable mirror, and then publish to any of the popular Linux or Windows machine can be virtualized. The container is full use of the sandbox mechanism will not have any interface with each other.

▍ What service model? C / S model. Docker is a client - server (c / s) architecture program. docker is a client (client) and daemons (server) to run.

▍ What communication?

Unix socket socket, such as: unix: /// var / run / docker / sock (default connection)

▍ that several parts?

  • Docker Client Client
  • Docker Daemon server (daemon)
  • Docker Image Mirror
  • Docker Container vessel

What is ▍ Docker warehouse (hub)?

Warehouse (Repository) is a centralized place to store the image. Docker official currently maintains a public warehouse dDocker Hub. Most of the demand can be downloaded directly through the mirror to achieve in Docker Hub.

What ▍ mirror (image)?

Understood as a read-only template for Docker engine, including the file system. Such as: a mirror may contain only a complete operating system environment, you can also install other applications. By versioning and incremental file system, Docker provides a very simple mechanism to create and update an existing image.

How to build ▍ mirror?

I.e. create a mirror, which contains the required installation and operation environment, program code, and the like. The creation process is to use Dockerfile to complete. The default is downloaded from Docker Hub public image source.

Dockerfile mirror effect is to build from scratch. It contains the necessary installation and operation environment, program code, and the like. The creation process is to use Dockerfile to complete. Dockerfile docker build command to prepare for building a custom mirror image.

 

 

In docker-compose in real time it can also be used to build. docker-compose.yml script docker-compose prepared can manage multiple mirrors, may be used between a plurality of mirror image official, and the custom layout Dockerfile constructed image mixing vessel and all the defined network ports, storage space definitions.

If the mirror image is taken down from the pull docker hub registry, then there is no need Dockerfile; if the mirror is required to build, it would be desirable to provide Dockerfile.

Dockerfile is to record the production process of a mirror. The script installation process all the recorded install again when executing the script on the line. As long as there Dockerfile script file (shell script), just docker build. Can be mirrored, and Dockerfile is a text file, modify also very convenient.

How ▍ container is started?

The final container is running by pulling the constructed image, to start the service by running a series of instructions (e.g., port mapping, external data loading, environmental variables, etc.). the difference:

  • For a single container, which can be run by docker run.
  • For more containers, which can be run by docker-compose up.

How ▍ run multiple containers? If the operation involves a plurality of containers (such as a service orchestration) can be achieved by docker-compose, it can easily be operated a plurality of containers as a service (of course, only one of these runs) and Providing scale (service expansion) function. docker-compose a container arrangement. For example, you have a mirror php, mysql a mirror, a mirror nginx. If you do not docker-compose, so each time you start, you need to start knocking parameters of each container, environment variables, vessel name, specify a different container link parameters so a series of operations, rather cumbersome.

 

 

But after using the docker-composer, you can put these commands one-time write docker-composer.yml file every time you start the whole environment (including three containers), you just knock a docker-composer up command can be a docker-compose solve what is a mirror project needs, each mirror how configuration, which volume to mount, which port mapping information, etc., are included in the docker-compose.yml years. To start the service, just docker-compose up on the line, stopping only need docker-compse stop / down

▍Dockerfile and docker-compse.yml text difference?

  • Dockerfile recording build process of a single mirror
  • docker-compse.yml recording a container arrangement (multiple mirrors) build process.

 

Guess you like

Origin www.cnblogs.com/a609251438/p/12142173.html