docker image: image

basic concepts

  • Mirror:

The term Docker's, a read-only image layer is referred to, a permanent image is not changed, since the image is not so this image is stateless.

  • Parent Mirror:

Each mirror may depend on another mirror consisting of one or more lower layer. We sometimes say, the lower the upper mirror is a mirror image of the Father.

  • Base image:

A parent does not have any mirror image of that of the mirror base.

Common Commands

imageName generally can be used to replace imageID

  • Get a mirror

docker pull  [repositoryURL/]ImageName[:TAG]。

TAG default is latest, to identify with a warehouse in different versions of the image (as when the latest, docker will track changes in the mirror, that is to say, it is best not to use latest).

repositoryURL specify the address of the warehouse, the default address in the configuration file.

Viewing Options: man docker-pull

  • View image information

docker images = docker image ls view existing native image:

REPOSITORY Different warehouse server, the situation mirrors the same name may appear, plus warehouse address prefix as an identifier.
IMAGE ID

Here only a portion is actually a complete 256-bit ID, a 64 hexadecimal characters, usually the ID may be used directly, but the shorter the ID, the greater the probability of collision.

This ID is the same mirror with a mirror, a mirror may have a different label names.

CTEATED The last modification time of the mirror.
  • Set up a new label for a local mirror

docker tag [option] oldImageName: TAG newImageName: TAG

Label actually creates a name for an existing image without overwriting the existing name, both are included.

  • View image details

docker  [image] inspect  [option]  imageName

  • Search Mirror

docker search [option] keyword 

option:man docker-search

  • Delete and clean up image

docker rmi imageName = docker image rm imageName

option:man dcoker-image rm [option]

When a local mirror there are multiple tabs, delete a label does not delete the local mirror, it will only delete the current label name until you remove the last tag name will be deleted local mirror

docker image prune [option]

Clean up temporary image file or image file not be used, the specific effects requires a combination of options to use

option:docker image prune --help

 

  • Create a mirror

1. Based on the existing container

We first need to get the existing container ID:

docker [container] commit  [option] containerID newImageID:TAG

Note that there is a container ID, not a mirror ID, it is based on the existing container create mirror

option:docker container commit --help

2. Based on the local template import

I learned to find information and so on that level again when the need to use update

3. Based on dockerfile create

I learned to find information and so on that level again when the need to use update

  • An image storage

Save the file to a local mirror, in order to share

docker [image] save [option] fileName.tar imageName:TAG

option:man docker-save

  • Loading image

docker [image] load [option] fileName

Create a mirror through a local file

option:man docker-load

  • Upload Mirror

docker [image] push imageName[:TAG]  |  [REGISTRY_HOST[:PORT]/]imageName[:TAG]

The first time there's other operations, information will be saved to ~ / .docker

 

 

View more commands and options directly docker image --help or man docker-images.

reference:

[1] http://www.dockerinfo.net

[2] Docker technology and technique Getting your hands dirty. Third Edition

Published 48 original articles · won praise 3 · Views 5156

Guess you like

Origin blog.csdn.net/ydeway/article/details/99718742