Docker command
1. Mirror IMAGES operation class
1. Image renaming
Docker tag IMAGE ID NEW REPOSITORY:NEW TAG
IMAGE ID indicates the existing image ID number, and NEW REPOSITORY:NEW TAG indicates the need for a new image name and label, as follows:
Or
Docker tag OLD REPOSITORY NEW REPOSITORY:NEW TAG
OLD REPOSITORY represents the original old image name
But note: docker renames the image, not really renaming it, but renaming the original image copy. The old image still exists.
2.docker uses commit to build a new image based on an existing image
Create a container with and stop running:
Docker run-itd-- name: / bin/bash
Docker stop
Build a new image based on the stopped container:
Docker:
For example:
Docker run-itd-- name ng nginx:latest / bin/bash
Docker stop ng
Docker 912d22c4d37e | ng 20190408_ngnix:20190408_latest
The principle of the construction process:
After creating a running container based on the existing basic image, while the container writes the content it needs, docker will copy the original image layer from top to bottom, and add a read-write layer (the content you need is written on the read-write layer), which is called "copy on write".
Then package the container commit into a new image, create and run a container with the new image, and the original read-write layer becomes a read-only layer.
2. Container operation
1. Run the container command to explain
Docker run-it-d-name ng nginx:latest / bin/bash
/ bin/bash: refers to the command that runs in the container, rather than specifying the bash interpreter on the host