Docker official to provide users with a quick understanding of Docker provides an interactive tutorial designed to help users learn how to use the Docker command line. Docker command line
The following is a brief introduction to the Docker command list, detailed in a later section. You can get help on the command line by running Docker, or the Docker Assistance command (we still use the CoreOS for VMware as the operating environment, which is the case if you have no special instructions):
Core@localhost ~ $ docker usage:docker [OPTIONS] COMMAND [arg ...] -h=[unix:///var/run/docker.sock]: Tcp://host:port to Bind/connect to or unix://path/to/socket to use A self-sufficient ru
Ntime for Linux containers. Commands:attach attach to a running container build builds an image from a dockerfile commit Create
A new image from a container ' s changes cp Copy files/folders from a container ' s filesystem to the host path Diff Inspect Changes on a container ' s filesystem events get real time events from the server export St
Ream the contents of a container as a tar archive history show the history of a image images List images
Import Create A new filesystem image from the contents of a Tarball info Display system-wide Information Inspect return low-level information in a container kill kill a running container load load an image f Rom a tar archive login Register or log iN to a Docker registry server logout Log out from a Docker registry server logs Fetch the logs of a Contai NER Port Lookup The public-facing port it nat-ed to Private_port pause pause all processes within a Container PS List containers pull pull an image or a repository from a Docker registry server push Push an image or a repository to a Docker registry server restart restart a running container RM Re Move one or more containers rmi Remove One or more images run run a command in a new container sav e Save an image to a tar archive search for ' an ' on the Docker Hub start a stopped Co Ntainer stop stop a running container tag tag an image into a repository top Lookup the Runni
ng processes of a container unpause unpause a paused container version show the Docker version information Wait block until a Container stops, then print its exit code
where info, version is the system environment information related commands events, history, logs is the log information related command Login\pull\push\search is the Dockerhub service related commands the rest are daily maintenance related commands
command Syntax
Basic usage: COMMAND + parameters
Core@localhost ~ $ docker Info
containers:7
images:123 Storage driver:btrfs Execution Driver
: native-0.2
Kernel version:3.16.2+
operating system:coreos 444.0.0
core@localhost ~ $ docker Version
Client version:1.2.0
client API version:1.14 go
version (client): go1.3.1
Git commit (client): Fa7b24f
os/arch (client): linux/amd64
server version:1.2.0
server API version:1.14 go
version (server): go1.3.1
Git Commit (server): fa7b24f
The parameters of a single character can be put together:
Core@localhost ~ $ docker run-t-I ubuntu:14.04/bin/bash
#使用分开的参数
root@d512e393fc74:/# exit
exit
Core@localhost ~ $ docker run-ti ubuntu:14.04/bin/bash
#将当个支付的参数放在一起
root@d170dacef325:/# exit
exit
Core@localhost ~ $ docker rm d51 D17
#多个参数放在一行
d51
d17
core@localhost ~ $
Docker Background Process parameters
Parameters |
introduce |
--api-enable-cors=false |
Remote API call. |
-B,--bridge= "" |
Bridging a bridge device on a system into a Docker container, where none can deactivate a network in a container |
--bip= "" |
Use CIDR addresses to set the IP of the Network Bridge. This parameter and-B cannot be used together. |
-D,--debug=false |
Turn on debug mode. Example: docker-d-D |
-D,--daemon=false |
Open daemon mode. |
--dns=[] |
The Settings container uses a DNS server. For example: docker-d--dns 8.8.8.8 |
-dns-search=[] |
The settings container uses the specified DNS search domain name. such as: docker-d--dns-search example.com |
--exec-driver= "native" |
Sets the container to use the specified Run-time driver. such as: docker-d-e Lxc |
-G,--group= "Docker" |
In the background run mode, give the specified group to the appropriate UNIX socket. Note that when this parameter--group assigns an empty string, the group information is stripped |
-G,--graph= "/var/lib/docker" |
To set the Docker runtime root directory |
-H,--host=[] |
Set the socket bindings specified in background mode to bind one or more tcp://host:port, Unix:///path/to/socket, fd://*, or FD://SOCKETFD. such as: $ docker-h tcp://0.0.0.0:2375 PS or $ export docker_host= "tcp://0.0.0.0:2375" $ docker PS |
-icc=true |
Set up traffic that enables the inline container. |
--ip= "0.0.0.0" |
Set the default IP address to use when a container binds IP |
--ip-forward=true |
Set the Net.ipv4.ip_forward of the startup container |
--iptables=true |
Set iptable rules for starting Docker container customizations |
--mtu=0 |
Sets the MTU value for the container network and, without this parameter, selects the default route MTU, which is set to a constant value of 1500 if there is no default route. |
-P,--pidfile= "/var/run/docker.pid" |
Sets the background process PID file path. |
-R,--restart=true |
Set up a container to run before restarting |
-S,--storage-driver= "" |
Set the container runtime to use the specified storage driver, such as specifying the use of Devicemapper, as follows: docker-d-S Devicemapper |
--selinux-enabled=false |
Setting Enable SELinux support |
--storage-opt=[] |
Setting Storage-driven parameters |
Docker configuration file location
Docker configuration files can set most of the background process parameters, the storage location in each operating system is inconsistent
The location in Ubuntu is:/etc/default/docker
The position in the CentOS is:/etc/sysconfig/docker
More information please pay attention to http://www.dockerpool.com