# Systemctl start docker // start docker
# Systemctl restart docker // restart docker
# Systemctl enable docker // set to enable auto-start
# Docker version // view the docker version
# Docker info // view docker details
# Docker -- help // view the help manual (detailed usage of docker commands)
# Docker images-A // view the existing docker Image
# Docker RMI (image ID) // Delete the running image file (-F: Force delete)
# Docker search XXXX-S 30 // search for images over 30 liked on docker Hub
# Docker pull XXXX // download the latest image information by default
# Docker run-It XXXX // run the docker Image
-I: Run containers interactively.
-T: re-allocate a pseudo-input terminal for the container
-D: start the process later (but the container must have a front-end process with the response, or the background process will automatically kill it if it thinks there is nothing to do; add a front-end interactive script: docker run-D centos/bin/sh-C ''while true; do echo Hello mycentos; sleep 5; done" -- name mycentos)
-- Name: Name the running container
-P: random port ing
-P: Specifies port ing (1.ip: hostport: containerport. 2.ip:: containerport. 3. hostport: containerport 4. containerport)
# Docker PS-A // view all docker Processes
# Docker PS-N 5 // view the last five docker Processes
# Docker stop (container ID) // stop the running container
# Docker start (container ID) // start the container
# Ctrl + q + P // temporarily exit the container
# Docker RM (container ID) // Delete the running container
# Docker logs-T (container ID) // view the logs of the running container
-T: Timestamp added
-F: prints the latest logs.
-- Tail 5: print the last five lines of logs
# Docker inspect (container ID) // view the internal details of the container
# Docker Exec-It (container ID) ls-L/home // run the container outside docker (view the information in the home directory of the centos container)
# Docker attach (container ID) // re-join the interactive interface
# Docker CP (container ID):/home/a. log/root // copy the. log file in the container to the external root directory.
Common docker commands