Small knowledge, big challenge! This paper is participating in theEssentials for programmers”Creative activities

This article also participated in the “Digitalstar Project” to win a creative gift package and creative incentive money

Common docker container commands

Docker there are a lot of command, let us one by one all back down, basic is impossible, the role of documentation is very big, want to query the order, direct to find documentation, documentation address: docs.docker.com/reference/, many in docker document lists the command usage.

General command

The docker –help command —- can be used to quickly check the usage of the command

Docker [OPTIONS] COMMANDCopy the code

2. Basic commands for mirroring

We can use Docker images –help to view all docker image-related commands

1. List all mirrors on the local machine

Docker images-a: list all local images (including the intermediate image layer) -q: display only image ids -- digker ests: --no-trunc: displays complete image information docker images -q: displays the ID of the imageCopy the code

Docker images-qa: Query the ids of all images, which can be used for batch deletionCopy the code

docker images --no-trunc
Copy the code

2. Search for images

Docker Search Specifies the image nameCopy the code

–filter=stars=3: lists mirrors whose likes are not less than the specified number

--no-trunc: displays a complete image description. -- Automated: lists only the images of the automated Build typeCopy the code


3. Pull the mirror

Docker pull image name [:tag] Tag is optional. Latest Using default tag: latest # Specifies the image used latest: Pulling from library/mysql A330b6cecb98: Pull complete # Pull complete 88e473c3f553: Pull complete 062463ea5d2f: Pull complete daf7e3bdf4b6: Pull complete 1839c0b7aac9: Pull complete cf0a0cfee6d0: Pull complete 1b42041bb11e: Pull complete 10459d86c7e6: Pull complete b7199599d5f9: Pull complete 1d6f51e17d45: Pull complete 50e0789bacad: Pull complete Digest: Sha256:99 e0989e7e3797cfbdb8d51a19d32c8d286dd8862794d01a547651a896bcf00c # image signature Status: Downloaded newer image for mysql: latest docker. IO/library/mysql: latest # mirror real address docker pull mysql docker pull Docker. IO/library/mysql: latest both is the same thingCopy the code

4. Delete the mirror

Docker RMI image name :tagCopy the code

Example Delete a running mirror

docker rmi -f hello-world
Copy the code

Deleting All Mirrors

Docker rmi -f ${docker images-qa} docker images-qa is the id of the current image, and then delete the imageCopy the code