If you are familiar with Git and GitHub, you can make an analogy with Docker, making it easier to understand Docker and Docker Hub and the relationship between crossing.
1. Docker version
Displays the Docker version information.
2. Docker Info
Displays Docker system information, including the number of mirrors and containers.
3. Docker Search
Docker search [options ' o ';] Term
Docker Search-s Django
Search for eligible mirrors from the Docker Hub.
--automated List only automated build
type of image;
--no-trunc can display the full image description;
-S 40 lists images with a collection of no less than 40.
4. Docker Pull
Docker pull [-a "o";] [user/"O" >]name[:tag "O";]
Docker Pull Laozhu/telescope:latest
Pull or update the specified image from the Docker Hub.
-A pulls all tagged images.
5. Docker Login
[Email protected]:~# Docker Login
Username:username
Password: * * *
Email: [Email protected]
Login succeeded
Enter the user name, password, and mailbox registered in the Docker Hub to complete the login process.
6. Docker Logout
Log out from the specified server after running, default to the official server.
7. Docker Images
Docker images [options ' o ';] [name]
Lists all local mirrors. Where [name] is the keyword query for the image name.
-A Lists all mirrors (with process mirrors);
-F filter image, such as:-F [' dangling=true '] list only satisfies
Mirroring of dangling=true conditions;
--no-trunc can display the full image ID;
-Q lists only the mirror IDs.
--tree lists all the commit histories of the image in a tree structure.
8. Docker PS
Lists all the running containers.
-A lists all containers (including sleeping mirrors);
--before= "Nginx" lists the container created before a container, accepting the container name and ID as parameters;
--since= "Nginx" lists the containers created after a container, accepting the container name and ID as parameters;
-F [exited=<int>] List satisfies
exited=<int> conditions of the container;
-l lists only the most recently created container;
--NO-TRUNC Displays the complete container ID;
-N=4 lists the 4 newly created containers;
-Q lists only the container ID;
-S displays the container size.
9. Docker RMI
Docker rmi [options ' o ';] <image> "O" >[image ...]
Docker RMI Nginx:latest Postgres:latest python:latest
Removes one or more specified mirrors from the local.
-F forcibly removes the image, even if it is being used;
--no-prune does not remove the process image of the image, which is removed by default.
Ten. Docker RM
Docker rm [options ' o ';] <container> "O" >[container ...]
Docker rm nginx-01 nginx-02 db-01 db-02
sudo docker rm-l/webapp/redis
-F forcibly removes the container, even if it is running;
-L removes the network connection between the containers, not the container itself;
-V removes the space associated with the container.
One. Docker history
Docker history "O" >[options] <image>
View the creation history of the specified image.
--no-trunc Display the complete submission record;
-Q lists only the commit record IDs.
Docker Start|stop|restart
Docker start|stop "P" >|restart [Options "O"] <container> "O" >[container ...]
Starts, stops, and restarts one or more specified containers.
-A pending completion
-I launches a container and enters interactive mode;
-T 10 time-out (in seconds) to stop or restart the container and the system will kill the process after a timeout.
Docker Kill
Docker kill "O" >[options "O" <container> "O" >[container ...]
Kills one or more specified container processes.
-S "KILL" to customize the signal sent to the container.
Docker events
Docker events [options ' o ';]
Docker events--since= "S2" > "20141020"
Docker events--until= "S2" > "20120310"
Pull personal dynamics from the server to select a time interval.
. Docker Save
Docker save-i "Debian.tar"
Docker Save > "Debian.tar"
Saves the specified image as a tar archive, and the reverse operation of Docker load. Images saved and Reloaded (saved-loaded) do not lose the commit history and layer, and can be rolled back.
-O "Debian.tar" specifies the saved image archive.
. Docker Load
Docker load [options]
Docker Load < Debian.tar
Docker load-i "Debian.tar"
The reverse operation of Docker save is downloaded from the TAR image archive as photographed. Images saved and Reloaded (saved-loaded) do not lose the commit history and layer, and can be rolled back.
-I "Debian.tar" specifies the loaded image archive.
. Docker Export
Docker Export <container>
Docker Export nginx-01 > Export.tar
Saves the specified container as a tar archive, and the reverse operation of Docker import. The container for export after import (exported-imported) will lose all commit history and cannot be rolled back.
Docker Import
Docker import url|-"O" >[repository[:tag "O";]
Cat Export.tar "P" >| Docker Import-imported-nginx:latest
Docker Import Http://example.com/export.tar
Create an image from an archive file (supporting remote files), and export the reverse operation to label the import image. The container for export after import (exported-imported) will lose all commit history and cannot be rolled back.
. Docker Top
Docker top <running_container> "O" >[ps options]
View a running container process that supports PS command parameters.
. Docker Inspect
Docker Instpect Nginx:latest
Docker Inspect Nginx-container
Check the parameters of the mirror or container and return the JSON format by default.
-f Specifies the template file for the return value.
. Docker Pause
Pauses all processes for a container.
Docker Unpause
Docker Unpause <container>
Restores all processes of a container.
. Docker tag
Docker tag [options ' o ';] <image>[:tag "O";] [repository/"O" >][username/]name "O" >[:tag]
Mark the local image and place it in a warehouse.
-F overrides an existing tag.
. Docker push
Docker push Name[:tag "O";]
Docker Push Laozhu/nginx:latest
Push the image to the remote repository, which defaults to the Docker Hub.
Docker logs
Docker logs [options ' o ';] <container>
Docker logs-f-T--tail= "S2" > "Ten" Insane_babbage
Gets the output log of the container runtime.
-F keeps track of recent updates to container logs;
-T displays the timestamp of the container log;
--tail= "10" lists only the latest 10 container logs.
. Docker Run
Docker run [Options "O"] <image> ["NB" >command] "O" >[arg ...]
Launches a container in which to run the specified command.
-a stdin specifies the standard input and output content type, optional stdin/
Stdout/stderr three items;
-D background runs the container and returns the container ID;
-I runs the container in interactive mode and is usually used with-t;
-T re-allocates a pseudo-input terminal to the container, usually with-I simultaneously;
--name= "nginx-lb" specifies a name for the container;
--dns 8.8.8.8 Specifies the DNS server used by the container, default and host consistent;
--dns-search example.com Specifies the container DNS search domain name, default and host consistent;
-H "Mars" specifies the hostname of the container;
-E Username= "Ritchie" setting environment variables;
--env-file=[] read from the specified file into the environment variable;
--cpuset= "0-2" or--cpuset= "0,1,2"
Binds the container to the specified CPU to run;
-C Pending Completion
-M pending completion
--net= "Bridge" specifies the type of network connection for the container, supports bridge/
Host/none
four types of container:<name|id>;
--link=[] Pending completion
--expose=[] Pending completion
The Docker command uses a detailed