查看當前Docker的版本信息;linux
root@willem:~# docker version Client: Version: 1.11.1 API version: 1.23 Go version: go1.5.4 Git commit: 5604cbe Built: Tue Apr 26 23:30:23 2016 OS/Arch: linux/amd64 Server: Version: 1.11.1 API version: 1.23 Go version: go1.5.4 Git commit: 5604cbe Built: Tue Apr 26 23:30:23 2016 OS/Arch: linux/amd64
查看Docker幫助信息;
使用過程當中能夠使用Docker提供的幫助功能查看命令的用法與相關信息。docker
docker --help
Docker基本語法;json
Usage: docker [OPTIONS] COMMAND [arg...] docker daemon [ --help | ... ] docker [ --help | -v | --version ] A self-sufficient runtime for containers.
選項;api
Options: # 指定Docker客戶端配置文件的路徑; --config=~/.docker Location of client config files # 是否使用Debug模式,默認爲false; -D, --debug Enable debug mode # 在daemon模式下綁定的socket,經過一個或多個 tcp://host:port, unix:///path/to/socket, fd://* or fd://socketfd來指定; -H, --host=[] Daemon socket(s) to connect to # 查看幫助信息,-h 和 --help 是同樣的; -h, --help Print usage # 設置日誌等級,-l 和 --log-level 是同樣的; -l, --log-level=info Set the logging level # 是否開啓tls,默認爲false; --tls Use TLS; implied by --tlsverify # 指定CA(Certificate Authority認證受權機構)簽名的信任證書的路徑; --tlscacert=~/.docker/ca.pem Trust certs signed only by this CA # 指定TLS證書文件的路徑; --tlscert=~/.docker/cert.pem Path to TLS certificate file # 指定TLS公鑰文件的路徑; --tlskey=~/.docker/key.pem Path to TLS key file # 使用TLS並驗證遠程控制主機; --tlsverify Use TLS and verify the remote # 輸出Docker的版本信息(簡略)並退出 -v, --version Print version information and quit
命令;服務器
Commands: # 依附到一個正在運行的容器中; attach Attach to a running container # 依據Dockerfile文件構建鏡像; build Build an image from a Dockerfile # 在容器中將容器構建爲一個新的鏡像; commit Create a new image from a container's changes # 在容器和宿主機之間拷貝文件/文件夾; cp Copy files/folders between a container and the local filesystem # 建立容器; create Create a new container # 檢查一個容器的文件系統的變動; diff Inspect changes on a container's filesystem # 從服務端獲取實時的事件; events Get real time events from the server # 在運行的容器中執行命令; exec Run a command in a running container # 將一個容器的文件系統導出爲一個tar包; export Export a container's filesystem as a tar archive # 顯示一個鏡像的構建歷史信息(鏡像的構建步驟記錄-相似Dockerfile); history Show the history of an image # 查詢鏡像列表; images List images # 從tarball導入內容建立一個文件系統映像; import Import the contents from a tarball to create a filesystem image # 顯示整個系統的信息; info Display system-wide information # 獲取容器或鏡像的低級信息; inspect Return low-level information on a container or image # 關閉一個正在運行的容器(包括進程和全部相關資源); kill Kill a running container # 從一個tar包或STDIN中加載一個鏡像; load Load an image from a tar archive or STDIN # 登錄Docker註冊服務器(上傳鏡像須要先登陸); login Log in to a Docker registry # 登出Docker註冊服務器(註銷); logout Log out from a Docker registry # 獲取一個容器的日誌信息; logs Fetch the logs of a container # 管理容器的網絡配置; network Manage Docker networks # 暫停一個容器內的全部進程; pause Pause all processes within a container # 列出一個容器的端口映射或一個特定映射的信息; port List port mappings or a specific mapping for the CONTAINER # 列出全部的容器; ps List containers # 從註冊服務器的倉庫中拉取一個鏡像; pull Pull an image or a repository from a registry # 向註冊服務器的倉庫中上傳一個鏡像; push Push an image or a repository to a registry # 將一個容器重命名; rename Rename a container # 重啓一個容器; restart Restart a container # 刪除一個或多個容器; rm Remove one or more containers # 刪除一個或多個鏡像; rmi Remove one or more images # 在一個新的容器中運行一個命令; run Run a command in a new container # 將一個或多個鏡像保存爲一個tar包; save Save one or more images to a tar archive # 在Docker Hub中搜索鏡像; search Search the Docker Hub for images # 啓動一個或多個暫停的容器; start Start one or more stopped containers # 動態顯示容器資源的使用狀況;例如「docker stats 8981」信息以下: # CONTAINER CPU % MEM USAGE/LIMIT MEM % NET I/O BLOCK I/O PIDS # 8981 0.00% 3.551MB/4.145GB 0.09% 509.6kB/14.15MB 2.028MB/0 B 0 stats Display a live stream of container(s) resource usage statistics # 中止一個正在運行的容器; stop Stop a running container # 修改本地倉庫中鏡像的標籤; tag Tag an image into a repository # 顯示一個容器中正在運行的進程; top Display the running processes of a container # 解除一個容器中全部進程的暫停狀態; unpause Unpause all processes within a container # 更新一個或多個容器的配置; update Update configuration of one or more containers # 顯示Docker的版本信息(詳細) version Show the Docker version information # 管理Docker的數據卷; volume Manage Docker volumes # 阻塞,直到一個容器中止,而後輸出它的退出代碼 wait Block until a container stops, then print its exit code # 運行「docker COMMAND --help」獲取更多的指令信息,如指令的用途與參數的詳細解釋。 Run 'docker COMMAND --help' for more information on a command.
舉例說明;
想要查看run命令的使用方法和參數含義-「docker run --help」。網絡
docker run --help
返回信息-run命令的用法說明;app
Usage: docker run [OPTIONS] IMAGE [COMMAND] [ARG...] Run a command in a new container
返回信息-run命令的參數說明;cors
-a, --attach=[] Attach to STDIN, STDOUT or STDERR --add-host=[] Add a custom host-to-IP mapping (host:ip) --blkio-weight Block IO (relative weight), between 10 and 1000 --blkio-weight-device=[] Block IO weight (relative device weight) --cpu-shares CPU shares (relative weight) --cap-add=[] Add Linux capabilities --cap-drop=[] Drop Linux capabilities --cgroup-parent Optional parent cgroup for the container --cidfile Write the container ID to the file --cpu-period Limit CPU CFS (Completely Fair Scheduler) period --cpu-quota Limit CPU CFS (Completely Fair Scheduler) quota --cpuset-cpus CPUs in which to allow execution (0-3, 0,1) --cpuset-mems MEMs in which to allow execution (0-3, 0,1) -d, --detach Run container in background and print container ID --detach-keys Override the key sequence for detaching a container --device=[] Add a host device to the container --device-read-bps=[] Limit read rate (bytes per second) from a device --device-read-iops=[] Limit read rate (IO per second) from a device --device-write-bps=[] Limit write rate (bytes per second) to a device --device-write-iops=[] Limit write rate (IO per second) to a device --disable-content-trust=true Skip image verification --dns=[] Set custom DNS servers --dns-opt=[] Set DNS options --dns-search=[] Set custom DNS search domains -e, --env=[] Set environment variables --entrypoint Overwrite the default ENTRYPOINT of the image --env-file=[] Read in a file of environment variables --expose=[] Expose a port or a range of ports --group-add=[] Add additional groups to join -h, --hostname Container host name --help Print usage -i, --interactive Keep STDIN open even if not attached --ip Container IPv4 address (e.g. 172.30.100.104) --ip6 Container IPv6 address (e.g. 2001:db8::33) --ipc IPC namespace to use --isolation Container isolation technology --kernel-memory Kernel memory limit -l, --label=[] Set meta data on a container --label-file=[] Read in a line delimited file of labels --link=[] Add link to another container --log-driver Logging driver for container --log-opt=[] Log driver options -m, --memory Memory limit --mac-address Container MAC address (e.g. 92:d0:c6:0a:29:33) --memory-reservation Memory soft limit --memory-swap Swap limit equal to memory plus swap: '-1' to enable unlimited swap --memory-swappiness=-1 Tune container memory swappiness (0 to 100) --name Assign a name to the container --net=default Connect a container to a network --net-alias=[] Add network-scoped alias for the container --oom-kill-disable Disable OOM Killer --oom-score-adj Tune host's OOM preferences (-1000 to 1000) -P, --publish-all Publish all exposed ports to random ports -p, --publish=[] Publish a container's port(s) to the host --pid PID namespace to use --pids-limit Tune container pids limit (set -1 for unlimited) --privileged Give extended privileges to this container --read-only Mount the container's root filesystem as read only --restart=no Restart policy to apply when a container exits --rm Automatically remove the container when it exits --security-opt=[] Security Options --shm-size Size of /dev/shm, default value is 64MB --sig-proxy=true Proxy received signals to the process --stop-signal=SIGTERM Signal to stop a container, SIGTERM by default -t, --tty Allocate a pseudo-TTY --tmpfs=[] Mount a tmpfs directory -u, --user Username or UID (format: <name|uid>[:<group|gid>]) --ulimit=[] Ulimit options --userns User namespace to use --uts UTS namespace to use -v, --volume=[] Bind mount a volume --volume-driver Optional volume driver for the container --volumes-from=[] Mount volumes from the specified container(s) -w, --workdir Working directory inside the container
查看Docker守護進程的模式配置的幫助信息;dom
docker daemon --help
用法說明;socket
Usage: docker daemon [OPTIONS] Enable daemon mode
參數說明;
--api-cors-header Set CORS headers in the remote API --authorization-plugin=[] List authorization plugins in order from first evaluator to last -b, --bridge Attach containers to a network bridge --bip Specify network bridge IP --cgroup-parent Set parent cgroup for all containers --cluster-advertise Address or interface name to advertise --cluster-store Set the cluster store --cluster-store-opt=map[] Set cluster store options --config-file=/etc/docker/daemon.json Daemon configuration file --containerd Path to containerd socket -D, --debug Enable debug mode --default-gateway Container default gateway IPv4 address --default-gateway-v6 Container default gateway IPv6 address --default-ulimit=[] Set default ulimits for containers --disable-legacy-registry Do not contact legacy registries --dns=[] DNS server to use --dns-opt=[] DNS options to use --dns-search=[] DNS search domains to use --exec-opt=[] Set runtime execution options --exec-root=/var/run/docker Root directory for execution state files --fixed-cidr IPv4 subnet for fixed IPs --fixed-cidr-v6 IPv6 subnet for fixed IPs -G, --group=docker Group for the unix socket -g, --graph=/var/lib/docker Root of the Docker runtime -H, --host=[] Daemon socket(s) to connect to --help Print usage --icc=true Enable inter-container communication --insecure-registry=[] Enable insecure registry communication --ip=0.0.0.0 Default IP when binding container ports --ip-forward=true Enable net.ipv4.ip_forward --ip-masq=true Enable IP masquerading --iptables=true Enable addition of iptables rules --ipv6 Enable IPv6 networking -l, --log-level=info Set the logging level --label=[] Set key=value labels to the daemon --log-driver=json-file Default driver for container logs --log-opt=map[] Set log driver options --mtu Set the containers network MTU -p, --pidfile=/var/run/docker.pid Path to use for daemon PID file --raw-logs Full timestamps without ANSI coloring --registry-mirror=[] Preferred Docker registry mirror -s, --storage-driver Storage driver to use --selinux-enabled Enable selinux support --storage-opt=[] Set storage driver options --tls Use TLS; implied by --tlsverify --tlscacert=~/.docker/ca.pem Trust certs signed only by this CA --tlscert=~/.docker/cert.pem Path to TLS certificate file --tlskey=~/.docker/key.pem Path to TLS key file --tlsverify Use TLS and verify the remote --userland-proxy=true Use userland proxy for loopback traffic --userns-remap User/Group setting for user namespaces