The help command

  • docker -info
Docker version Version information Docker info Displays docker system information, including images and containers docker command --help View help commandsCopy the code

Documentation: docs.docker.com/engine/refe…

The mirror command

Documentation: docs.docker.com/engine/refe…

Docker Images view all images

Docker images -q displays only the image IDCopy the code

Docker Search searches for images

 docker search [OPTIONS] TERM
Copy the code

Docker pull Downloads the image

 docker pull [OPTIONS] NAME[:TAG|@DIGEST]
Copy the code
Name, shorthand Default Description
–all-tags , -a Download all tagged images in the repository
–disable-content-trust true Skip image verification
–platform
–quiet , -q Suppress verbose output
  • The TAG version number
  • @ DIGEST image in this paper

You can specify a version number or get it from the digest

$ docker pull ubuntu:14.04
$ docker pull ubuntu@sha256:45b23dee08af5e43a7fea6c4cf9c25ccf269ee113168c19722f87876677c5cb2
Copy the code

Docker RMI delete image

docker rmi [OPTIONS] IMAGE [IMAGE...]  docker rmi -f ${docker images -aq}Copy the code
Name, shorthand Default Description
–force , -f Force removal of the image
–no-prune Do not delete untagged parents

Container order

Prerequisite: You can create containers only if there is an image

Run the container

docker run [OPTIONS] IMAGE [COMMAND] [ARG...]  docker run --name="Name"Name a container to distinguish between -d background running -i and -t interactive running -p Specified port -p Host port: container port -p Random portCopy the code

Check the container

Docker ps View all running containers -A View all running containers + Containers that have been run in the past -n=m Display m recently created containers -q display only the numberCopy the code

Container operations – Start stop

Docker start Container ID Start docker restart Container ID Restart docker Stop Container ID Stop docker kill Container ID Forcibly stop dockerCopy the code

Out of the container

Exit Stops the container and exits

Ctrl P Q Exits without stopping

Remove the container

Docker rm containers id to delete, can't delete a running container docker rm -f ${docker ps - aq} mandatory delete all containers docker ps - a - q | xargs docker rm to delete allCopy the code

See the log

docker logs
Copy the code
–details Displays additional details provided to the log
–follow,-f Paying Attention to Log Output
–since Displays logs since time stamps (e.g. 2013-01-02T13:23:37z) or relative logs (e.g. 42m 42min)
–tail,-n all The number of lines displayed from the end of the log
–timestamps,-t Display time stamp
–until Display logs (e.g. 2013-01-02T13:23:37z) or relative logs (e.g. 42m 42min) before time stamps
View mirror metadata
docker inspect
Copy the code
–format,-f Format the output using the given Go template
–size,-s Displays total file size if type is container
–type Returns a specific type of JSON
Enter the running container
Docker attach container ID Docker attach container ID Docker attach container ID Docker attach container IDCopy the code

Copy data in a container to a host

Docker cp Container ID: Container path Host pathCopy the code

Submit the image to the local PC

Docker commit -m =' Commit info '-a=' author' Container ID Target image name: version numberCopy the code