Docker mirror and container differences in the detailed _docker

Source: Internet
Author: User
Tags docker run

Recently learning Docker, was Docker mirror and the container to make the dizzy, straight online to find relevant information and tidy up a thorough understanding of this piece of content, there is a need for small partners can see, less to go a little detour.

The difference between a Docker mirror and a container

First, Docker mirror

It's really not easy to understand the difference between a Docker mirror and a Docker container.

Assuming that the Linux kernel is the No. 0 tier, then no matter how the Docker is run, it runs on top of the kernel layer. This Docker mirror, which is a read-only mirror, is on layer 1th and cannot be modified or saved.

A docker mirror can be built on top of another Docker mirror, which can be multilayered. The 1th layer of the mirror layer is called the underlying mirror (base image), and the mirror of the other layer (except the topmost) is called the parent image. These mirrors inherit all of the properties and settings of their parent layer mirroring and add their own configuration to the Dockerfile.

Docker mirrors are identified by the mirror ID. The Mirror ID is a 64-character hexadecimal string. But when we run the mirror, we usually don't use the mirror ID to refer to the mirror, but we use the mirror name to refer to it. To list all valid mirrors locally, you can use the command

# Docker Images

Mirroring can be published as a different version, which we call tags (tag).

As shown in the figure above, there are two versions of the NEO4J Mirror: The lastest version and the 2.1.5 version.

You can use the Pull command plus the specified label:

# Docker Pull ubuntu:14.04
# Docker Pull ubuntu:12.04

Second, Docker container

Docker containers can be created using commands:

# Docker Run ImageName

It adds a writable layer over all the mirrored layers. This writable layer has processes running on the CPU and has two different states: the Run State (Running) and the Exit State (exited). This is the Docker container. When we use the Docker run to start the container, the Docker container enters the running state, and when we stop the Docker container, it enters the exit state.

When we have a running Docker container, from the run state to the stop state, all changes we make to it are permanently written to the container's file system. Remember that changes to the container are written to the container's file system rather than to the Docker mirror.

We can start multiple Docker containers with the same image, which are active after they are activated and isolated from each other. The changes we make to one of the containers will only be limited to the container itself.

If the underlying image of the container is modified, the currently running container is unaffected and no automatic updates occur.

If you want to update the container to a new version of its mirror, you must be careful to make sure that we build the data structure in the right way, otherwise we may result in losing all the data in the container.

A 64-character hexadecimal string that defines the container ID, which is the unique identifier of the container. The interaction between the containers is identified by the container ID, and because the container ID's characters are too long, we usually just type the first 4 characters of the container ID. Of course, we can also use the container name, but obviously it's easier to use a 4-character container ID.

Thank you for reading, I hope to help you, thank you for your support for this site!

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.