A detailed description of mirror layering technology in Docker

Source: Internet
Author: User

As early as the container did not appear, there are many transport workers on the pier to carry the goods, in the container after the appearance of the pier to see more not workers, and container transport mode more single, more efficient, there are other benefits, such as: the goods are packed in containers, Can prevent the goods from interacting with each other before. And to another pier to be transported, with the container after the direct transport of it to another container, it can be fully guaranteed that the goods inside is the overall relocation, and will not damage the goods themselves. the Docker image also plays a very important role in the IT industry.

  What is a docker image

is to put the business code, the operational environment for the overall packaging

  How to create a docker Image:

now the official Docker Warehouse has a large number of mirrors, so the most basic image, we can directly pull in the shared warehouse, because these images are original maintenance, you can get even updates and repair.

  Dockerfile:

if we want to customize these images, we can write Dockerfile, and then re - bulid, and finally packaged it into a mirror, this is the most recommended way, including when we go to the enterprise to practice the application is also recommended this way.

  Commit:

of course, there is another way, is to start a container through the mirror, and then do the operation, and finally commit the command through a commit a mirror, but not recommended this way, although said by Commit This command is like the operation of the virtual machine mode, but the container is a container, it is not a virtual machine, so we still have to adapt to use Dockerfile to customize these images to this habit.

The concept of mirroring is mainly the packaging of the operating environment and business code Mirroring, our lesson is to understand the image of layered technology, we first look at a image of Ubuntu system.

we can mirror a lot of layers , and they all have size and ID, and we can see there are 4 layer IDs here. the image is a combination of their layer , and this image is read-only, it can't write data inside, what if you want to write data? We're going to start a layer of containon the mirror, whichis actually the equivalent of starting the image into a container, so we can write it on the container layer.

For example, we want to be in this Ubuntu This system add a layer, can only continue to overlay above, these work is actually by Cow, write the mechanism under the font to achieve.

  Sub-image

Download will only download the top layer of the sub-image, because the other layers have already, then it can be a space-saving role.

  Parent image

The most typical is the layered technology of mirroring --AUFS

  Aufs is an abbreviation for the another Union File System and supports mounting multiple directories to the same virtual directory.

the constructed image is set to read-only mode, andthe Read-write write operation is An incremental operation on read-only that does not affect read-only Layer.

This research has a benefit, for example, we can now see the App, in the command will be used in the app field to come back, before the next time it is a static, we did not write to the inside, but when we start up, we can write things inside, do a variety of operations. But if we turn it off later, or delete it later, it's this image is far away, so in this image will not be modified. And there will be a very good place, this scenario is very suitable for us to implement the test environment, because our test environment is often an operation is to fill the data, we can pre-package this image data into the test, then this image software contains, the top is Nginx, for example, it will have some data, we can play a layer of data on it, after playing it into a container can be tested, after testing the container will generate a variety of data, that is, dirty data, so that we can delete this container, After deletion, the containers inside our mirrors will not be affected. If it wants to create another set, we can start the image again with a container, it can be an identical, and a clean environment.

original link:http://www.maiziedu.com/wiki/cloud/dockerimage/

A detailed description of mirror layering technology in Docker

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.