In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-02-24 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >
Share
Shulou(Shulou.com)06/03 Report--
What is the relationship between containers and mirrors in docker?
After learning docker recently, most people feel that containers and mirrors are a little vague.
In particular, the mirror image and the container feel completely inseparable, so learn here, and then summarize it for the convenience of later study.
This is my summary of the overall hierarchical structure of the image:
VM/ host-- > operating system (e.g. centos)-- > image img (including complete systems such as linux (ubuntu), mysql, apache, nginx, etc.). A mirror is made up of layers of system files. ) install-- > create container-- > create application (APP).
A complete docker consists of the following parts:
DockerClient client
Docker Daemon daemon
Docker Image Mirror
DockerContainer container
What problem to solve: container-- > image-- > tar file
When the test environment is restored: tar-- > Mirror-- > Container
The difference between a mirror and a container: an image can be understood as a java class, and a container as an object in java. That is, mirror: Java class; container: java object.
Many objects can be created through classes, that is, mirrors can create many containers.
In addition:
The entire life cycle of docker consists of three parts: image + container + repository.
Docker container = image + readable layer
The container is instantiated from the image.
To put it simply, the image is a file and the container is a process.
The container is created based on the image, that is, the processes in the container depend on the files in the image.
Docker's concept of mirroring is similar to the mirroring of virtual machines. Is a read-only template, a separate file system, including the data needed to run the container, which can be used to create a new container.
Docker uses containers to run applications: docker containers are running instances created by docker images.
The docker container is similar to a virtual machine and can be executed including start, stop, delete, etc. Each container is isolated from each other. A specific application is run in the container, containing the code for the specific application and the required dependent files. Think of the container as a simple version of the linux environment (including root user rights, process space, user space, cyberspace, etc.) and applications running in it.
In the life cycle of Docker, there are two core parts, one is the mirror Images and the other is the container Containers.
When the image runs, it is the container.
During the operation of CCS, changes are made based on the original image, such as installing the program, adding files, or submitting it back (commit) to become an image.
For example, an image can contain a complete ubuntu operating system environment with only mysql or other applications that the user needs.
A docker image is actually made up of a layer of system files. This level of file system is called UnionFS (Union file system Unified File system). The image can be built based on dockerfile. Dockerfile is a description file that contains several secret commands. Each command creates a new hierarchy for the underlying file system.
Docker provides a simple mechanism to create or update existing images. Users can even download a ready-made image from others and use it directly. (the image is read-only and can be understood as a static file)
The container is dynamic relative to the mirror, and the container creates a writable layer as the top layer at startup.
(docker create: add a read / write layer to the specified image to form a new container;)
Docker repository: if you use git and github, it is easy to understand the warehouse concept of docker. The concept of docker warehouse is similar to git.
Docker repository is used to contain the location of images. Docker provides a registration server (register) to store multiple repositories, and each repository can contain multiple images with different tag.
The default warehouse used in docker operations is the docker hub public warehouse.
The operation supported by the repository is similar to git. After users have created their own image, they can use the push command to upload it to a public or private repository. So the next time you use this image on another machine, you just need to pull down from the warehouse.
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.