Docker Learning Note 5: Creating a mirror with the commit command and deleting a local mirror

Source: Internet
Author: User
Tags tagname docker run

I. Overview

There are two ways to create a mirror, one with the commit command, and the second with the Dockerfile method (which is more commonly described in the following article). This chapter describes the commit method.

Before we introduce the commit command, we review the versioning of the code, and when we change the code, we commit to the version server.

For a container-like concept, the commit command can be used to commit the modification to a new image once the container has been created, if the container has been modified later.

Ii. Illustrative examples

Let's take a concrete example to illustrate:

1. Create a new container

Docker run--name newcontent-i-T Ubuntu/bin/bash

2, to operate, modify the contents of the container

echo Hello World >>test.txt//Create a file with the redirect feature

3. Exit the shell and close the container.

4. Use the diff command to view container change information

Diff//root//test.txt

5. Create a new image
Docker commit Newcontent Newnewcontent2

A mirror is created locally that has a warehouse named Newnewcontent2,tag with the default value of latest.

The image name for the specification should be:

[Username/]repositoryname[:tagname]

such as: Docker commit newcontent jeme/myubuntu:1.0

If there is no tagname, the default is latest.

Note: If you need to submit the image to the Dokcer hub hub, you must standardize the naming (must be username/warehouse name, tag can default), and the previous user name is the username registered on the Dokcer hub.

Third, delete the local mirror

Docker RMI Image name/id

Docker Learning Note 5: Creating a mirror with the commit command and deleting a local mirror

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.