5.4 docker command Daquan

111

1, the search image
Docker Search Tomcat 2, pulling / delete image Docker pull Tomcat
 Docker RMI image ID // delete the specified image
Docker RMI $ (Docker Images -q) // delete all the image  3, image starting container according // - name: custom container name -d: background tomcat: image name is the latest to be run: the version number of  Docker rUN --name mytomcat -d tomcat: latest  // - the p-: the host port mapping to a port on the container  RUM -d -p 8888 Docker: 8080 Tomcat 3.1 into the container running  docker exec -it bash shell container ID // bash shell / bin / bash open a new terminal in the container, and can start a new process  docker attach the container ID // attach directly to the container terminal start command will not start a new process (re-enter) 4. Check the operation of the vessel  Docker PS // Docker PS --format ".ID the Table {{}} \ t {{.} Image } \ T {{.}} Names \ T " Docker PS -a
// query for all vessels, including not running 5, stop / start / Remove container  docker stop container id // stop the container is running
 docker start container id // start the container, the container may also be a name
 docker rm container id // delete container can be added to force the removal of the -f option represents
6,   6.1 to view internal details of the container   docker inspect container ID 7, 8, 8.1 8.2 exit container   exit // vessel to stop and exit   Ctrl + P + Q // container does not stop exit 9 , docker cleanup command  
  
Docker the kill $ (Docker PS -a -q) // kill all running container -q: show only container number
  Docker RM $ (Docker PS -a -q) / / batch delete all been stopped container   Docker rmi $ (Docker ImagesRF Royalty Free dangling = -q -f to true) // delete all with no label image


10, to demonstrate a simple closed firewall linux   -Service Status firewalld; // Check firewall status   -Service firewalld STOP // turn off the firewall 11, to view the container log   Docker logs Container-name / ID-Container 12 is, copy files from the container to the host (from the host to copy files container, by way of the data mount)   Docker CP container ID: path to the destination host within the container path   docker cp host_path containerID: container_path // copied from the host to the container

 

Start redis container:

docker run -p 6379: 6379 --name myredis -v $ PWD / data: / data -d redis: latest redis-server --appendonly yes 
Command Description: 
-p 6379: 6379: 6379 mapped to the host port of the container port 6379 (where 6379 is the default port number redis); 
-v $ the PWD / data: / data: the data in the current directory is mounted to the main container / data; 
redis-Server --appendonly Yes: in the container execution redis-server start command, and open redis persistence configuration

 

Guess you like

Origin www.cnblogs.com/shiyun32/p/11068392.html
5.4