文章目錄
說明
其中*標表示常用
docker
Usage: docker COMMAND
# 用法:docker命令
A self-sufficient runtime for containers # 容器自己運行時
Options:
--config string Location of client config files (default
"C:\\Users\\登陸名\\.docker")
-D, --debug Enable debug mode
-H, --host list Daemon socket(s) to connect to
-l, --log-level string Set the logging level
("debug"|"info"|"warn"|"error"|"fatal")
(default "info")
--tls Use TLS; implied by --tlsverify
--tlscacert string Trust certs signed only by this CA (default
"C:\\Users\\登陸名\\.docker\\ca.pem")
--tlscert string Path to TLS certificate file (default
"C:\\Users\\登陸名\\.docker\\cert.pem")
--tlskey string Path to TLS key file (default
"C:\\Users\\登陸名\\.docker\\key.pem")
--tlsverify Use TLS and verify the remote
-v, --version Print version information and quit
Management Commands:
checkpoint Manage checkpoints
config Manage Docker configs
container Manage containers
image Manage images
network Manage networks
node Manage Swarm nodes
plugin Manage plugins
secret Manage Docker secrets
service Manage services
swarm Manage Swarm
system Manage Docker
trust Manage trust on Docker images
volume Manage volumes
Commands:
attach Attach local standard input, output, and error streams to a running container
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
deploy Deploy a new stack or update an existing stack
diff Inspect changes to files or directories on a container's filesystem
events Get real time events from the server
exec Run a command in a running container # 在正在運行的容器中運行命令
export Export a container's filesystem as a tar archive
history Show the history of an image
images List images
import Import the contents from a tarball to create a filesystem image
info Display system-wide information
inspect Return low-level information on Docker objects
kill Kill one or more running containers
load Load an image from a tar archive or STDIN
login Log in to a Docker registry
logout Log out from a Docker registry
logs Fetch the logs of a container
pause Pause all processes within one or more containers
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 one or more containers
rm Remove one or more containers
rmi Remove one or more images
run Run a command in a new container
save Save one or more images to a tar archive (streamed to STDOUT by default)
search Search the Docker Hub for images
start Start one or more stopped containers
stats Display a live stream of container(s) resource usage statistics
stop Stop one or more running containers
tag Create a tag TARGET_IMAGE that refers to SOURCE_IMAGE
top Display the running processes of a container
unpause Unpause all processes within one or more containers
update Update configuration of one or more containers
version Show the Docker version information
wait Block until one or more containers stop, then print their exit codes
Run 'docker COMMAND --help' for more information on a command.
docker exec
Usage: docker exec [OPTIONS] CONTAINER COMMAND [ARG...]
Run a command in a running container # 在容器中運行一個命令
Options:
-d, --detach Detached mode: run command in the background # 分離模式:在後臺運行命令
--detach-keys string Override the key sequence for detaching a container # 重寫用於分離容器的鍵序列
-e, --env list Set environment variables # 設置環境變量
* -i, --interactive Keep STDIN open even if not attached # 即使沒有連接,也要打開
--privileged Give extended privileges to the command # 將擴展權限授予命令
* -t, --tty Allocate a pseudo-TTY # 分配一個僞TTY
-u, --user string Username or UID (format:
<name|uid>[:<group|gid>]) # 用戶名或UI
-w, --workdir string Working directory inside the container # 容器內的工作目錄
docker run
Usage: docker run [OPTIONS] IMAGE [COMMAND] [ARG...]
Run a command in a new container # 在新容器中運行命令
Options:
--add-host list Add a custom host-to-IP mapping (host:ip) # 添加自定義主機到IP的映射(主機:ip)
-a, --attach list Attach to STDIN, STDOUT or STDERR # 附加到stdin,stdout或stderr
--blkio-weight uint16 Block IO (relative weight), between 10 and 1000, or 0 to disable (default 0) # 塊io(相對重量),介於10到1000之間,或0禁用(默認爲0)
--blkio-weight-device list Block IO weight (relative device weight) (default []) # 你的體重(體重相對塊設備(默認)[ ])
--cap-add list Add Linux capabilities # 添加Linux功能
--cap-drop list Drop Linux capabilities # 刪除Linux功能
--cgroup-parent string Optional parent cgroup for the container # 容器的可選父cgroup
--cidfile string Write the container ID to the file # 將容器id寫入文件
--cpu-period int Limit CPU CFS (Completely Fair Scheduler) period # 限制CPU CFS(完全公平調度器)週期
--cpu-quota int Limit CPU CFS (Completely Fair Scheduler) quota # 限制CPU CFS(完全公平調度器)配額
--cpu-rt-period int Limit CPU real-time period in microseconds # 限制cpu的實時週期(以微秒爲單位)
--cpu-rt-runtime int Limit CPU real-time runtime in microseconds # 限制cpu的實時運行時間(以微秒爲單位)
-c, --cpu-shares int CPU shares (relative weight) # CPU份額(相對權重)
--cpus decimal Number of CPUs # CPU數
--cpuset-cpus string CPUs in which to allow execution(0-3, 0,1) # 允許執行的CPU(0-3,0,1)
--cpuset-mems string MEMs in which to allow execution(0-3, 0,1) # 允許執行的MEMS(0-3,0,1)
* -d, --detach Run container in background and print container ID # 在後臺運行一個容器並打印出容器id
--detach-keys string Override the key sequence for detaching a container # 重寫用於分離容器的鍵序列
--device list Add a host device to the container # 將主機設備添加到容器中
--device-cgroup-rule list Add a rule to the cgroup allowed devices list # 將規則添加到cgroup允許的設備列表中。
--device-read-bps list Limit read rate (bytes per second) from a device (default []) # 限制設備的讀取速率(每秒字節)(默認[])
--device-read-iops list Limit read rate (IO per second) from a device (default []) # 限制設備的讀取速率(IO/秒)(默認[])
--device-write-bps list Limit write rate (bytes per second) to a device (default []) # 限制設備的寫入速率(每秒字節)(默認[])
--device-write-iops list Limit write rate (IO per second) to a device (default []) # 限制設備的寫入速率(每秒IO)(默認[])
--disable-content-trust Skip image verification (default true) # 跳過圖像驗證(默認爲true)
--dns list Set custom DNS servers # 設置自定義DNS服務器
--dns-option list Set DNS options # 設置DNS選項
--dns-search list Set custom DNS search domains # 設置自定義DNS搜索域
--entrypoint string Overwrite the default ENTRYPOINT of the image # 覆蓋鏡像的默認入口點
* -e, --env list Set environment variables # 設置環境變量
--env-file list Read in a file of environment variables # 在環境變量文件中讀取
--expose list Expose a port or a range of ports # 暴露端口或端口範圍
--group-add list Add additional groups to join # 添加要加入的其他組
--health-cmd string Command to run to check health # 命令運行以檢查健康
--health-interval duration Time between running the check (ms|s|m|h) (default 0s) # 運行檢查之間的時間(ms s m h)(默認的0)
--health-retries int Consecutive failures needed to report unhealthy # 報告不健康的連續失敗
--health-start-period duration Start period for the container to initialize before starting health-retries countdown (ms|s|m|h) (default 0s) # 容器在開始健康狀態重試倒計時之前初始化的起始時間(ms_s_s\m_h)(默認的0~s)
--health-timeout duration Maximum time to allow one check to run (ms|s|m|h) (default 0s) # 允許運行一次檢查的最長時間(ms_s_s\m\h)(默認爲0)
--help Print usage # 打印使用方法
-h, --hostname string Container host name # 容器主機名
--init Run an init inside the container that forwards signals and reaps processes # 在容器內運行init,以轉發信號和獲取進程。
-i, --interactive Keep STDIN open even if not attached # 即使沒有連接,也要打開
--ip string IPv4 address (e.g., 172.30.100.104) # ipv4地址
--ip6 string IPv6 address (e.g., 2001:db8::33) # ipv6地址
--ipc string IPC mode to use # 要使用的IPC模式
--isolation string Container isolation technology # 集裝箱隔離技術
--kernel-memory bytes Kernel memory limit # 內核內存限制
-l, --label list Set meta data on a container # 在容器上設置元數據
--label-file list Read in a line delimited file of labels # 讀取以行分隔的標籤文件
--link list Add link to another container # 將鏈接添加到另一個容器
--link-local-ip list Container IPv4/IPv6 link-local
addresses
--log-driver string Logging driver for the container
--log-opt list Log driver options
--mac-address string Container MAC address (e.g.,
92:d0:c6:0a:29:33)
-m, --memory bytes Memory limit
--memory-reservation bytes Memory soft limit
--memory-swap bytes Swap limit equal to memory plus
swap: '-1' to enable unlimited swap
--memory-swappiness int Tune container memory swappiness
(0 to 100) (default -1)
--mount mount Attach a filesystem mount to the
container
--name string Assign a name to the container # 爲容器指定名稱
--network string Connect a container to a network
(default "default")
--network-alias list Add network-scoped alias for the
container
--no-healthcheck Disable any container-specified
HEALTHCHECK
--oom-kill-disable Disable OOM Killer
--oom-score-adj int Tune host's OOM preferences (-1000
to 1000)
--pid string PID namespace to use
--pids-limit int Tune container pids limit (set -1
for unlimited)
--platform string Set platform if server is
multi-platform capable
--privileged Give extended privileges to this
container
-p, --publish list Publish a container's port(s) to
the host
-P, --publish-all Publish all exposed ports to random ports # 將所有公開的端口發佈到隨機端口
--read-only Mount the container's root filesystem as read only # 將容器的根文件系統掛載爲只讀
--restart string Restart policy to apply when a container exits (default "no") # 重新啓動策略以在容器退出時應用(默認“否”)
--rm Automatically remove the container when it exits # 容器退出時自動移除
--runtime string Runtime to use for this container # 用於此容器的運行時
--security-opt list Security Options # 安全性選項
--shm-size bytes Size of /dev/shm # /dev/shm大小
--sig-proxy Proxy received signals to the process (default true) # 代理接收到進程的信號(默認爲true)
--stop-signal string Signal to stop a container(default "15") #停止容器的信號(默認爲“15”)
--stop-timeout int Timeout (in seconds) to stop a container # 停止容器的超時(以秒爲單位)
--storage-opt list Storage driver options for the container # 容器的存儲驅動程序選項
--sysctl map Sysctl options (default map[]) # sysctl選項(默認映射[])
--tmpfs list Mount a tmpfs directory # 掛載tmpfs目錄
-t, --tty Allocate a pseudo-TTY # 分配一個僞TTY
--ulimit ulimit Ulimit options (default [])
-u, --user string Username or UID (format:
<name|uid>[:<group|gid>])
--userns string User namespace to use
--uts string UTS namespace to use
-v, --volume list Bind mount a volume # 綁定裝入卷
--volume-driver string Optional volume driver for the container # 容器的可選卷驅動程序
--volumes-from list Mount volumes from the specified container(s) # 從指定容器安裝卷
-w, --workdir string Working directory inside the container
docker pull
Usage: docker pull [OPTIONS] NAME[:TAG|@DIGEST]
Pull an image or a repository from a registry # 從註冊表中提取圖像或存儲庫
Options:
-a, --all-tags Download all tagged images in the repository # 下載存儲庫中的所有標記圖像
--disable-content-trust Skip image verification (default true) #跳過圖像驗證(默認爲true)
--platform string Set platform if server is multi-platform capable # 如果服務器具有多平臺能力,則設置平臺
docker inspect
Usage: docker inspect [OPTIONS] NAME|ID [NAME|ID...]
Return low-level information on Docker objects # 返回docker對象的最低級信息。
Options:
-f, --format string Format the output using the given Go template # 使用給定的GO模板格式化輸出
-s, --size Display total file sizes if the type is container # 如果類型是容器,則顯示文件的總大小。
--type string Return JSON for specified type # 返回指定類型的json
docker container
Usage: docker container COMMAND
Manage containers
Options:
Commands:
attach Attach local standard input, output, and error streams to a running container # 將本地標準輸入、輸出和錯誤流附加到正在運行的容器中。
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 to files or directories on a container's filesystem # 檢查容器文件系統上文件或目錄的更改
exec Run a command in a running container # 在正在運行的容器中運行命令
export Export a container's filesystem as a tar archive # 將容器的文件系統導出爲tar存檔
inspect Display detailed information on one or more containers # 在一個或多個容器上顯示詳細信息
kill Kill one or more running containers # 殺死一個或多個正在運行的容器
logs Fetch the logs of a container # 獲取容器的日誌
ls List containers # 列表容器
pause Pause all processes within one or more containers # 暫停一個或多個容器內的所有進程
port List port mappings or a specific mapping for the container # 列出端口映射或容器的特定映射
prune Remove all stopped containers # 移除所有停止的容器
rename Rename a container # 重命名容器
restart Restart one or more containers # 重新啓動一個或多個容器
rm Remove one or more containers # 移除一個或多個容器
run Run a command in a new container 在新容器中運行命令
start Start one or more stopped containers 啓動一個或多個已停止的容器
stats Display a live stream of container(s) resource usage statistics # 顯示容器資源使用統計數據的活動流。
stop Stop one or more running containers # 停止一個或多個正在運行的容器
top Display the running processes of a container # 顯示容器的運行過程
unpause Unpause all processes within one or more containers # 取消暫停一個或多個容器中的所有進程。
update Update configuration of one or more containers 更新一個或多個容器的配置
wait Block until one or more containers stop, then print their exit codes # 阻塞,直到一個或多個容器停止爲止,然後打印它們的出口代碼。
Run 'docker container COMMAND --help' for more information on a command.
docker container update
Usage: docker container update [OPTIONS] CONTAINER [CONTAINER...]
Update configuration of one or more containers
Options:
--blkio-weight uint16 Block IO (relative weight), between 10 and 1000, or 0 to disable (default 0)
--cpu-period int Limit CPU CFS (Completely Fair Scheduler) period
--cpu-quota int Limit CPU CFS (Completely Fair Scheduler) quota
--cpu-rt-period int Limit the CPU real-time period in microseconds
--cpu-rt-runtime int Limit the CPU real-time runtime in microseconds
-c, --cpu-shares int CPU shares (relative weight)
--cpus decimal Number of CPUs
--cpuset-cpus string CPUs in which to allow execution (0-3, 0,1)
--cpuset-mems string MEMs in which to allow execution (0-3, 0,1)
--kernel-memory bytes Kernel memory limit
-m, --memory bytes Memory limit
--memory-reservation bytes Memory soft limit
--memory-swap bytes Swap limit equal to memory plus swap:'-1' to enable unlimited swap
--restart string Restart policy to apply when a container exits
docker container ls
Usage: docker container ls [OPTIONS]
List containers
Aliases:
ls, ps, list
Options:
-a, --all Show all containers (default shows just running) # 顯示所有容器(默認顯示正在運行)
-f, --filter filter Filter output based on conditions provided # 基於所提供條件的濾波器輸出
--format string Pretty-print containers using a Go template # 使用GO模板的漂亮打印容器
-n, --last int Show n last created containers (includes all
states) (default -1) # 顯示n最後創建的容器(包括所有狀態)(默認-1)
-l, --latest Show the latest created container (includes all
states) # 顯示最新創建的容器(包括所有狀態)
--no-trunc Don't truncate output # 不要截斷輸出
-q, --quiet Only display numeric IDs # 只顯示數字ID
-s, --size Display total file sizes # 顯示總文件大小
docker ps
# 請查看docker container ls
docker build
Usage: docker build [OPTIONS] PATH | URL | -
Build an image from a Dockerfile # 從dockerfile構建鏡像
Options:
--add-host list Add a custom host-to-IP mapping (host:ip)
--build-arg list Set build-time variables
--cache-from strings Images to consider as cache sources
--cgroup-parent string Optional parent cgroup for the container
--compress Compress the build context using gzip
--cpu-period int Limit the CPU CFS (Completely Fair
Scheduler) period
--cpu-quota int Limit the CPU CFS (Completely Fair
Scheduler) quota
-c, --cpu-shares int CPU shares (relative weight)
--cpuset-cpus string CPUs in which to allow execution (0-3, 0,1)
--cpuset-mems string MEMs in which to allow execution (0-3, 0,1)
--disable-content-trust Skip image verification (default true)
-f, --file string Name of the Dockerfile (Default is
'PATH/Dockerfile')
--force-rm Always remove intermediate containers
--iidfile string Write the image ID to the file
--isolation string Container isolation technology
--label list Set metadata for an image
-m, --memory bytes Memory limit
--memory-swap bytes Swap limit equal to memory plus swap:
'-1' to enable unlimited swap
--network string Set the networking mode for the RUN
instructions during build (default "default")
--no-cache Do not use cache when building the image
--platform string Set platform if server is multi-platform
capable
--pull Always attempt to pull a newer version of
the image
-q, --quiet Suppress the build output and print image
ID on success
--rm Remove intermediate containers after a
successful build (default true)
--security-opt strings Security options
--shm-size bytes Size of /dev/shm
--squash Squash newly built layers into a single
new layer
--stream Stream attaches to server to negotiate
build context
-t, --tag list Name and optionally a tag in the 'name:tag' format # 名稱,也可以選擇“name:tag”格式的標記
--target string Set the target build stage to build. # 將目標生成階段設置爲“生成”。
--ulimit ulimit Ulimit options (default []) # 超限制選項(默認[])
docker-machine
Usage: docker-machine [OPTIONS] COMMAND [arg...]
Create and manage machines running Docker. # 創建和管理運行docker的機器。
Version: 0.13.0, build 9ba6da9
Author:
Docker Machine Contributors - <https://github.com/docker/machine>
Options:
--debug, -D Enable debug mode
--storage-path, -s "C:\Users\hanxinxing\.docker\machine" Configures storage path [$MACHINE_STORAGE_PATH]
--tls-ca-cert CA to verify remotes against [$MACHINE_TLS_CA_CERT]
--tls-ca-key Private key to generate certificates [$MACHINE_TLS_CA_KEY]
--tls-client-cert Client cert to use for TLS [$MACHINE_TLS_CLIENT_CERT]
--tls-client-key Private key used in client TLS auth [$MACHINE_TLS_CLIENT_KEY]
--github-api-token Token to use for requests to the Github API [$MACHINE_GITHUB_API_TOKEN]
--native-ssh Use the native (Go-based) SSH implementation. [$MACHINE_NATIVE_SSH]
--bugsnag-api-token BugSnag API token for crash reporting [$MACHINE_BUGSNAG_API_TOKEN]
--help, -h show help
--version, -v print the version
Commands:
active Print which machine is active
config Print the connection config for machine
create Create a machine # 創造一臺機器
env Display the commands to set up the environment for the Docker client
inspect Inspect information about a machine
ip Get the IP address of a machine
kill Kill a machine
ls List machines
provision Re-provision existing machines
regenerate-certs Regenerate TLS Certificates for a machine
restart Restart a machine
rm Remove a machine
ssh Log into or run a command on a machine with SSH. # 使用ssh登錄或在計算機上運行命令。
scp Copy files between machines
mount Mount or unmount a directory from a machine with SSHFS.
start Start a machine
status Get the status of a machine
stop Stop a machine
upgrade Upgrade a machine to the latest version of Docker
url Get the URL of a machine
version Show the Docker Machine version or a machine docker version
help Shows a list of commands or help for one command
Run 'docker-machine COMMAND --help' for more information on a command.
docker-machine create
Usage: docker-machine create [OPTIONS] [arg...]
Create a machine
Description:
Run 'docker-machine create --driver name --help' to include the create flags for that driver in the help text.
Options:
--driver, -d "virtualbox" Driver to create machine with. [$MACHINE_DRIVER] # 要用.[$Machine_Driver]創建機器的驅動程序
--engine-env [--engine-env option --engine-env option] Specify environment variables to set in the engine
--engine-insecure-registry [--engine-insecure-registry option --engine-insecure-registry option] Specify insecure registries to allow with the created engine
--engine-install-url "https://get.docker.com" Custom URL to use for engine installation [$MACHINE_DOCKER_INSTALL_URL]
--engine-label [--engine-label option --engine-label option] Specify labels for the created engine
--engine-opt [--engine-opt option --engine-opt option] Specify arbitrary flags to include with the created engine in the form flag=value
--engine-registry-mirror [--engine-registry-mirror option --engine-registry-mirror option] Specify registry mirrors to use [$ENGINE_REGISTRY_MIRROR]
--engine-storage-driver Specify a storage driver to use with the engine
--swarm Configure Machine to join a Swarm cluster
--swarm-addr addr to advertise for Swarm (default: detect and use the machine IP)
--swarm-discovery Discovery service to use with Swarm
--swarm-experimental Enable Swarm experimental features
--swarm-host "tcp://0.0.0.0:3376" ip/socket to listen on for Swarm master
--swarm-image "swarm:latest" Specify Docker image to use for Swarm [$MACHINE_SWARM_IMAGE]
--swarm-join-opt [--swarm-join-opt option --swarm-join-opt option] Define arbitrary flags for Swarm join
--swarm-master Configure Machine to be a Swarm master
--swarm-opt [--swarm-opt option --swarm-opt option] Define arbitrary flags for Swarm master
--swarm-strategy "spread" Define a default scheduling strategy for Swarm
--tls-san [--tls-san option --tls-san option] Support extra SANs for TLS certs
--virtualbox-boot2docker-url The URL of the boot2docker image. Defaults to the latest available version [$VIRTUALBOX_BOOT2DOCKER_URL]
--virtualbox-cpu-count "1" number of CPUs for the machine (-1 to use the number of CPUs available) [$VIRTUALBOX_CPU_COUNT]
--virtualbox-disk-size "20000" Size of disk for host in MB [$VIRTUALBOX_DISK_SIZE]
--virtualbox-host-dns-resolver Use the host DNS resolver [$VIRTUALBOX_HOST_DNS_RESOLVER]
--virtualbox-hostonly-cidr "192.168.99.1/24" Specify the Host Only CIDR [$VIRTUALBOX_HOSTONLY_CIDR]
--virtualbox-hostonly-nicpromisc "deny" Specify the Host Only Network Adapter Promiscuous Mode [$VIRTUALBOX_HOSTONLY_NIC_PROMISC]
--virtualbox-hostonly-nictype "82540EM" Specify the Host Only Network Adapter Type [$VIRTUALBOX_HOSTONLY_NIC_TYPE]
--virtualbox-hostonly-no-dhcp Disable the Host Only DHCP Server [$VIRTUALBOX_HOSTONLY_NO_DHCP]
--virtualbox-import-boot2docker-vm The name of a Boot2Docker VM to import [$VIRTUALBOX_BOOT2DOCKER_IMPORT_VM]
--virtualbox-memory "1024" Size of memory for host in MB [$VIRTUALBOX_MEMORY_SIZE]
--virtualbox-nat-nictype "82540EM" Specify the Network Adapter Type [$VIRTUALBOX_NAT_NICTYPE]
--virtualbox-no-dns-proxy Disable proxying all DNS requests to the host [$VIRTUALBOX_NO_DNS_PROXY]
--virtualbox-no-share Disable the mount of your home directory [$VIRTUALBOX_NO_SHARE]
--virtualbox-no-vtx-check Disable checking for the availability of hardware virtualization before the vm is started [$VIRTUALBOX_NO_VTX_CHECK]
--virtualbox-share-folder Mount the specified directory instead of the default home location. Format: dir:name [$VIRTUALBOX_SHARE_FOLDER]
--virtualbox-ui-type "headless" Specify the UI Type: (gui|sdl|headless|separate) [$VIRTUALBOX_UI_TYPE]