docker info #View local docker informationdocker search openresty #Search for remote image warehousedocker images #View the current system image warehouse imagedocker ps #View the currently running containerdocker pull centos #Get the remote image, the default tag is not specified, which is the latestdocker container run -p 8000:80 --rm -t -i centos:latest /bin/bash #-p maps the container port 80 to the node node8000 port, --rm terminates and deletes the container, which is suitable for temporary debugging, the -t option allows Docker to allocate a pseudo-terminal (pseudo-tty) and bind it to the standard input of the container, and -i keeps the standard input of the container opendocker container exec -i -t b5d7bad57561 /bin/bash #Enter the running containerdocker rmi $(docker images -f "dangling=true" -q)#Batch delete invalid none images
docker save -o centos7.tar centos #Export imagedocker load < centos7.tar #Import image (standard stream loading, including raw data such as tags)docker load --input centos7.tar #Read image from tarball (non-standard loading)
docker ps #Default display of currently running containersdocker ps -a #View all containers including those that have been stoppeddocker ps -l #Display the latest started container (including stopped ones)docker export 5a80afa126ba > centos7.5a80afa126ba.tar #Export container snapshotdocker import 5a80afa126ba > centos7.5a80afa126ba.tar #Import from container snapshot file to image repository
Note: Users can use docker load to import image storage files to the local image repository, or use docker import to import a container snapshot to the local image repository. The difference between the two is that the container snapshot file will discard all historical records and metadata information (that is, only save the snapshot state of the container at that time), while the image storage file will save the complete record and the volume is also large. In addition, metadata information such as labels can be re-specified when importing from a container snapshot file.
docker image build . #Build image based on current directory dockerfiledocker image build -t cm-navigation:v0.0.1 . #Build image based on current directory dockerfile and tag