- More commands are available on the official website: https://docs.docker.com/engine/reference/commandline/docker/
View the current image list
docker image ls [OPTIONS] [REPOSITORY[:TAG]] List images Aliases: ls, images, list Options: -a, --all Show all images (default hides intermediate images) --digests Show digests -f, --filter filter Filter output based on conditions provided --format string Pretty-print images using a Go template --no-trunc Don''t truncate output -q, --quiet Only show numeric IDs
As you can see from Aliases
docker images docker image ls docker image list
All three commands can view the docker image list
Get Mirror
docker image pull [OPTIONS] NAME[:TAG|@DIGEST] [flags] Options: -a, --all-tags Download all tagged images in the repository --disable-content-trust Skip image verification (default true) --platform string Set platform if server is multi-platform capable Params: NAME Mirror name.Mirroring can be done in Docker Store Find its name on.Generally user/repo:tag Format of
Mirrors can be obtained locally first by using the commands above.Docker's query is in Docker Store Conduct.
for example
Searching niweigede yields the following results
You can see that the description of this mirror uses the apt sources of ubuntu,java-8,ssh, and tsinghua.
Getting a mirror can also use the docker pull command
delete mirror
docker image rm [OPTIONS] IMAGE [IMAGE...] Remove one or more images Aliases: rm, rmi, remove Options: -f, --force Force removal of the image --no-prune Do not delete untagged parents
When removing a mirror, the IMAGE parameter can specify the name or ID of the mirror.
If the deleted mirror A has a local mirror B based on A production, delete A report'conflict: unable to delete 5a662682895c (cannot be forced) - image has dependent child images'error directly.At this point, you need to disassociate, that is, delete B before you can continue deleting A
Run Mirror
docker run [OPTIONS] IMAGE [COMMAND] [ARG...] Run a command in a new container
There are many OPTIONS under the run command, which is not fully listed here. Please query for it yourself.
Run the mirror and enter the console
docker run -i -t niweigede/ujava:1.1
The above command indicates opening a new container based on mirrored niweigede/ujava:1.1.Where -i means to keep a standard input STDIN and -t means to assign a virtual console TTY to interact with the container
Establish port mapping to host machine network
docker run -it -p 8070:8080 niweigede/ujava:1.1
Use the command-p port mapping as follows
format: ip:hostPort:containerPort | ip::containerPort | hostPort:containerPort | containerPort Both hostPort and containerPort can be specified as a range of ports. When specifying ranges for both, the number of container ports in the range must match the number of host ports in the range. (e.g., `-p 1234-1236:1234-1236/tcp`)
Custom container name
docker run -it --name CUSTOMER_NAME niweigede/ujava:1.1
Assign a custom name "CUSTOMER_NAME" to the upcoming container s using the command--name
Add data volume mount
docker run -it -v /home/host:/home/container niweigede/ujava:1.1
Use command-v for data volume mounting. Detailed usage is as follows
Create a bind mount with: [host-dir:]container-dir[:rw|ro]. If 'host-dir' is missing, then docker creates a new volume. If neither 'rw' or 'ro' is specified then the volume is mounted in read-write mode.