Today to learn command contains the remaining five rmi, tag, the build, the history, save, import

Today, we will continue to learn our Docker command. After a simple understanding of the command, we will start to implement the Docker container and apply our command. Today we will continue to learn about the local image management commands in the six major Docker commands. We will learn about the images commands in the previous article. We will learn about the container Docker commands in the second series. import

rmi

Docker RMI [OPTIONS] Image name

Example Delete one or more local mirrors

OPTIONS is an optional operation:

-f: Forcible deletion

–no-prune: does not remove the process mirror of the mirror. The default operation is remove.

docker@ubuntu:~$ docker images REPOSITORY TAG IMAGE ID CREATED SIZE mongo latest 8bf72137439e 4 days ago 380MB redis Latest 4e8DB158f18d 11 days ago 83.4MB docker@ubuntu:~$docker rmi redis Untagged: redis:latest Untagged: redis@sha256:858b1677143e9f8455821881115e276f6177221de1c663d0abef9b2fda02d065 Deleted: sha256:4e8db158f18dc71307f95260e532df39a9b604b51d4e697468e82845c50cfe28 Deleted: sha256:f0a7bdb1c3ed0d654f4c089184d736248a36fe904656c4a6907d2c1af3e28886 Deleted: sha256:96aa0bbe90a1e1cc0400b9ae97ceae726b4c8a4b4e86cbaa38577437b1747317 Deleted: sha256:098bb5a74892a87af81f5eb190c2768aaa2a625300b111270c53951488995658 Deleted: sha256:e6b3eda8746c5cc312ebb40e1ca5c064638af429b9b3848280aab8ed882bd10b Deleted: sha256:aee8b479b9a768a64f4c32d69108566fbdbb71c8e541496dd1fa9f7ad19d8632 Deleted: sha256:cdb3f9544e4c61d45da1ea44f7d92386639a052c620d1550376f22f5b46981af docker@ubuntu:~$ docker images REPOSITORY TAG IMAGE ID CREATED SIZE mongo latest 8bf72137439e 4 days ago 380MBCopy the code

# tag

Docker tag [OPTION] sourceImage[: tag] targetImage[: tag]

Tag the local image into its repository. Create a new tag or tag of some kind for the source target’s tag

OPTION can be selected:

-f: indicates mandatory overwrite

An example shows the modify tag below. The tag usually represents the version

docker@ubuntu:~$ docker images REPOSITORY TAG IMAGE ID CREATED SIZE mongo latest 8bf72137439e 4 days ago 380MB docker@ubuntu:~$Docker Tag Mongo :latest Mongo :13.2 docker@ubuntu:~$Docker images REPOSITORY Tag IMAGE ID CREATED SIZE Mongo 13.8bf72137439e 4 days ago 380MBCopy the code

# build

docker build [OPTIONS] PATH | URL | –

Docker builds are used to create images using dockerfiles.”

OPTIONS are optional, but we should also understand the common optional parameters used in building.






































So how do we use it?

If we have a Dockerfile in our current directory then use or not the current directory

Docker build -t mongo:12.1 docker build -f Dockerfile File pathCopy the code

Of course, in addition to local files, we can also be remote repository path, such as remote URL, Git repository and so on.

example

docker build github.com/creack/docker-firefoxCopy the code

Execution process:

Sending build context to Docker Daemon 72.19KB Step 1/7: From Ubuntu :12.04 12.04 Pulling from library/ubuntu d8868e50ac4c: Pull complete 83251ac64627: Pull complete 589bba2f1b36: Pull complete d62ecaceda39: Waiting 6d93b41cfc6b: Download completeCopy the code

Today let’s take a look at these three commands and try them out. With more practice, we can get familiar with these commands and master how to use them.


The original article was published on August 18, 2018

Author: Qiqi

This article is from the cloud community partner “LuckQI”. For more information, follow “LuckQI”.