Management and creation of Docker images

Source: Internet
Author: User
Tags docker ps docker hub docker run

1. Docker images and Docker containers:     Docker images are actually a series of file systems, typically a two-tier filesystem for Linux, Bootfs and Rootfs, Bootfs is bootloader and kernel, the system starts loading BOOTFS, loading complete kernel up, Bootfs is unloaded, rootfs is mounted, and running the program, ROOTFS can be a variety of different distributions, such as Fedora,ubuntu.     Docker image has multiple layers of FS, the bottom is bootfs, the second layer is ROOTFS, and there are other file systems, Docker file system is read-only, after loading Rootfs, Docker can load more upper-level read-only file system , and eventually these file systems will be put together, from the outside, there is only one file system. Such file systems are superimposed, independent of each other, and Docker's file system is called mirroring. In other words, the image of Docker can be placed on top of another mirror. And the mirror is read-only, to operate on the mirrored data, the Docker container must initialize a read-write file system, load the following read-only image into a read-write file system, and read and write, while the underlying read-only image does not change, which is "copy-on-write." So a container is actually Docker generating a read-write layer and its configuration data, plus the underlying read-only mirror composition. The container can be modified, but the image cannot be modified. This ensures that the containers generated from the same image are independent and non-intrusive.  2. Docker image Tags:    docker images are stored in a Docker repository, and a Docker repository can hold many mirrors, which can be labeled differently for different mirrors in order to differentiate between different mirrors in the same warehouse. For example, to distinguish the different images of the Ubuntu warehouse, you can ubuntu:14.04 tag. When pulling with pull, you can also add the tag pull, special, the official warehouse pull, without tagging, the default is to pull the latest image, labeled latest.  3. Some operation commands for Docker images:    Docker images list locally existing mirrors;    Docker pull Img_name:img_tag from Docker hub named Img_name , the mirror labeled Img_tag;    Docker search xxxx looks for mirroring from Dockerhub; &nbSp;4. Creating a docker image:    rarely builds a mirror from zero, it is a new image that is built from a published image. There are two main methods of,    1. Use the Docker commit command     2. Use the Dockerfile file and the Docker build command to introduce the first (the first is the simplest, but the second is the official recommendation):    run a container first:        Dcoker start con_name        Docker attach con_name    then install a software in the container, install a vim        AP     T-get Install Vimbuild image Be sure to stop the container, exit the container, stop the container, and build the image. Use the Docker Stop Con_name command. You can then use the Docker commit to build the container, and the Docker commit commits the modification, and git commit is never a stranger. Docker commit-a your_name-m message Con_name Username/reps:tag Where-a specifies the author,-m specifies the submission information, username is the user name, reps is the warehouse name, and tag is the tag.The first one is the image you just created. You can then use the Docker Run command to create and launch a new container with the image you just created, and then with Docker Ps-a, the first container is the one you just created, with the image you just built.

Management and creation of Docker images

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.