Study command, official documents do not forget, not here to check.
Help orders
1. Display the docker commands
docker --help
Copy the code
In addition, you can also check the usage of specific commands, for example, I want to know what the command Docker images does and how to use it.
docker images --help
Copy the code
2. The docker version information is displayed
docker version
Copy the code
3. The docker system information is displayed
This includes the number of mirrors and containers.
docker info
Copy the code
Docker images
1. View all mirrors on the local host
docker images
Copy the code
The first line of the result has several fields, respectively:
- REPOSITORY: the REPOSITORY source of the image, downloaded by this name and run by this name.
- TAG: indicates the version of the image.
- IMAGE ID: indicates the ID of an IMAGE.
- CREATED: indicates the time when a mirror is CREATED.
- SIZE: indicates the SIZE of the mirror.
Common options
Options:
-a, --all Show all images (default hides intermediate images)
-q, --quiet Only show image IDs
Copy the code
- -a: Lists all mirrors.
- -q: Displays only the mirror ID.
2. Search the image docker Search
In addition to searching in the mirror warehouse of the web page, you can also search on the command line. For example, search mysql mirror.
docker search mysql
Copy the code
The result is a list of mirrors that match the search keywords: name, description, number of stars, official, and so on.
Common options
-f, --filter filter Filter output based on conditions provided
Copy the code
I can add some filter criteria, such as I only search for mysql related stars with 3000 or more.
3. Download docker Pull
Download the mysql image I just found.
docker pull mysql
Copy the code
The real address, in fact, the command docker pull mysql equivalent to the docker pull docker. IO/library/mysql: the latest
Specifies the image version to download
Docker pull mysql: 5.7Copy the code
Note that 5.7 must be the version that exists in the mirror.
Notice in the result, there is a difference in the above, there is Already exists, which indicates that the above several mirrors, I Already have, do not need to download again, can share. Great resource savings, which is the advantage of Linux federated file systems.
Check the local image, mysql has two downloaded images, one is the latest version, the other 5.7.
4. Delete the image Docker RMI
Delete the specified image based on the mirror ID. Mysql > delete mirror id from mysql5.7
docker rmi -f 2c9028880e58
Copy the code
As you can see, the files shared with the mysql image are not deleted.
Delete multiple mirrors.
docker rmi -f id id id
Copy the code
Delete all.
docker rmi -f $(docker images -aq)
Copy the code
You’ll learn more commands as you go along.