这里解释一下docker -h 所查看到的选项
[root@master ~]# docker -h
Flag shorthand -h has been deprecated, please use --help
Usage: docker [OPTIONS] COMMAND
A self-sufficient runtime for containers
#这些命令用于管理 Docker 容器和镜像。
Common Commands:
run Create and run a new container from an image
#run: 从镜像创建并运行一个新的容器。
exec Execute a command in a running container
#exec: 在一个正在运行的容器中执行命令。
ps List containers
#ps: 列出容器。
build Build an image from a Dockerfile
#build: 从 Dockerfile 构建一个镜像。
pull Download an image from a registry
#pull: 从镜像仓库下载一个镜像。
push Upload an image to a registry
#push: 将一个镜像上传到镜像仓库。
images List images
#images: 列出镜像。
login Log in to a registry
#login: 登录到一个镜像仓库。
logout Log out from a registry
#logout: 从一个镜像仓库注销。
search Search Docker Hub for images
#logout: 从一个镜像仓库注销。
version Show the Docker version information
#version: 显示 Docker 版本信息。
info Display system-wide information
#info: 显示系统范围的信息。
#这些是 Docker 的管理命令,用于管理容器、镜像、网络等不同方面的功能:
Management Commands:
builder Manage builds
#builder: 管理构建(build)相关的功能,比如构建镜像。
buildx* Docker Buildx
#buildx*: Docker Buildx,用于实验性的多平台镜像构建。
compose* Docker Compose
#compose*: Docker Compose,用于定义和运行多个容器的应用程序。
container Manage containers
#container: 管理容器,比如启动、停止、删除容器等。
context Manage contexts
#context: 管理上下文,可以用来切换 Docker 守护进程的连接。
image Manage images
#image: 管理镜像,比如列出、删除、打标签等。
manifest Manage Docker image manifests and manifest lists
#manifest: 管理 Docker 镜像清单和清单列表,通常与多平台构建相关。
network Manage networks
#network: 管理网络,比如创建、连接、断开网络等。
plugin Manage plugins
#network: 管理网络,比如创建、连接、断开网络等。
system Manage Docker
#system: 管理 Docker 系统,包括信息、事件、登录等。
trust Manage trust on Docker images
#trust: 管理 Docker 镜像的信任。
volume Manage volumes
#volume: 管理卷,用于持久化容器中的数据。
#这是用于管理 Docker Swarm 的命令:
Swarm Commands:
swarm Manage Swarm
#swarm: 用于管理 Docker Swarm,包括初始化 Swarm、加入节点、更新配置等操作。
#这些是 Docker 命令的详细说明:
Commands:
attach Attach local standard input, output, and error streams to a running container
#attach: 将本地标准输入、输出和错误流附加到正在运行的容器。
commit Create a new image from a container's changes
#commit: 从容器的更改创建一个新的镜像。
cp Copy files/folders between a container and the local filesystem
#cp: 在容器和本地文件系统之间复制文件/文件夹。
create Create a new container
#create: 创建一个新的容器。
diff Inspect changes to files or directories on a container's filesystem
#diff: 检查容器文件系统中文件或目录的变化。
events Get real time events from the server
#events: 从服务器获取实时事件。
export Export a container's filesystem as a tar archive
#export: 将容器的文件系统导出为一个 tar 归档。
history Show the history of an image
#history: 显示一个镜像的历史记录。
import Import the contents from a tarball to create a filesystem image
#import: 从一个 tar 文件导入内容以创建一个文件系统镜像。
inspect Return low-level information on Docker objects
#inspect: 返回 Docker 对象的底层信息。
kill Kill one or more running containers
#kill: 终止一个或多个正在运行的容器。
load Load an image from a tar archive or STDIN
#load: 从一个 tar 归档或标准输入加载一个镜像。
logs Fetch the logs of a container
#logs: 获取一个容器的日志。
pause Pause all processes within one or more containers
#pause: 暂停一个或多个容器内的所有进程。
port List port mappings or a specific mapping for the container
#port: 列出容器的端口映射或一个特定映射
rename Rename a container
#rename: 重命名一个容器。
restart Restart one or more containers
#restart: 重新启动一个或多个容器。
rm Remove one or more containers
#rm: 移除一个或多个容器。
rmi Remove one or more images
#rmi: 移除一个或多个镜像。
save Save one or more images to a tar archive (streamed to STDOUT by default)
#save: 将一个或多个镜像保存为一个 tar 归档(默认通过 STDOUT 流式传输)。
start Start one or more stopped containers
#start: 启动一个或多个停止的容器。
stats Display a live stream of container(s) resource usage statistics
#stats: 显示一个或多个容器资源使用情况的实时流。
stop Stop one or more running containers
#stop: 停止一个或多个正在运行的容器。
tag Create a tag TARGET_IMAGE that refers to SOURCE_IMAGE
#tag: 创建一个指向源镜像的目标镜像的标签。
top Display the running processes of a container
#top: 显示一个容器的运行进程。
unpause Unpause all processes within one or more containers
#unpause: 恢复一个或多个容器内的所有进程。
update Update configuration of one or more containers
#update: 更新一个或多个容器的配置。
wait Block until one or more containers stop, then print their exit codes
#wait: 阻塞直到一个或多个容器停止,然后打印它们的退出代码。
#这里为docker命令的全局选项
Global Options:
--config string Location of client config files (default "/root/.docker")
#--config string: 指定客户端配置文件的位置,默认为 "/root/.docker"。
-c, --context string Name of the context to use to connect to the daemon (overrides DOCKER_HOST
env var and default context set with "docker context use")
#-c, --context string: 指定连接到守护进程的上下文名称,会覆盖 DOCKER_HOST 环境变量以及使用 "docker context use" 设置的默认上下文。
-D, --debug Enable debug mode
#-D, --debug: 启用调试模式。
-H, --host list Daemon socket to connect to
#-H, --host list: 指定连接的守护进程套接字。
-l, --log-level string Set the logging level ("debug", "info", "warn", "error", "fatal") (default "info")
#-l, --log-level string: 设置日志级别,可选值为 "debug", "info", "warn", "error", "fatal",默认为 "info"。
--tls Use TLS; implied by --tlsverify
#--tls: 使用 TLS 加密通信,这个选项被 --tlsverify 隐式包含。
--tlscacert string Trust certs signed only by this CA (default "/root/.docker/ca.pem")
#--tlscacert string: 指定 CA 证书的路径,默认为 "/root/.docker/ca.pem"。
--tlscert string Path to TLS certificate file (default "/root/.docker/cert.pem")
#--tlscert string: 指定 TLS 证书的路径,默认为 "/root/.docker/cert.pem"。
--tlskey string Path to TLS key file (default "/root/.docker/key.pem")
#--tlskey string: 指定 TLS 密钥文件的路径,默认为 "/root/.docker/key.pem"。
--tlsverify Use TLS and verify the remote
#--tlsverify: 使用 TLS 加密通信并验证远程端。
-v, --version Print version information and quit
#-v, --version: 打印 Docker 版本信息并退出。
Run 'docker COMMAND --help' for more information on a command.
For more help on how to use Docker, head to https://docs.docker.com/go/guides/
[root@master ~]#
这里是 Docker 命令行接口的手册页面,解释了 docker 命令的使用方式、选项、命令等。
DOCKER(1) Docker User Manuals DOCKER(1)
NAME #这里给出命令的名称,即是 docker
docker - Docker image and container command line interface
SYNOPSIS #显示了命令的语法。
docker [OPTIONS] COMMAND [ARG...]
#docker [OPTIONS] COMMAND [ARG...]表示使用 Docker 命令时可以附加选项,然后是要执行的命令及其参数。
docker [--help|-v|--version]
#docker [--help|-v|--version]: 这是 docker 命令的全局选项,其中
#--help 打印使用说明,-v 打印版本信息,
#--version 打印版本信息,其中 --help 和 --version 是互斥的。
DESCRIPTION
#说明了 Docker 是一个用于通过 CLI 与守护进程(dockerd)进行交互的客户端。
docker is a client for interacting with the daemon (see dockerd(8)) through the CLI.
#它还提到 Docker CLI 包含了30多个命令,每个命令都有自己的手册页面,
The Docker CLI has over 30 commands. The commands are listed below and each has its own man page which explains usage and arguments.
#解释了使用方法和参数。如果想查看某个命令的手册,可以运行 man docker。
To see the man page for a command run man docker .
OPTIONS #这一段是关于 Docker 命令的选项说明:
--help
Print usage statement
#--help: 打印使用说明。
--config=""
Specifies the location of the Docker client configuration files. The default is '~/.docker'.
#--config=" ": 指定 Docker 客户端配置文件的位置,默认为 '~/.docker'。
-D, --debug=true|false
Enable debug mode. Default is false
#-D, --debug=true|false: 启用调试模式。默认为 false。
-H, --host=[unix:///var/run/docker.sock]: tcp://[host]:[port][path] to bind or unix://[/path/to/socket] to use.
The socket(s) to bind to in daemon mode specified using one or more
tcp://host:port/path, unix:///path/to/socket, fd://* or fd://socketfd.
#-H, --host=[unix:///var/run/docker.sock]: tcp://[host]:[port][path]: 绑定守护进程模式下的套接字,可以指定一个或多个套接字,可以是 TCP 或 Unix 套接字。
If the tcp port is not specified, then it will default to either 2375 when
#当指定 TCP 时,可以设置主机、端口和路径。如果未指定 TCP 端口,则默认为 2375(当 --tls 未开启时)
--tls is off, or 2376 when --tls is on, or --tlsverify is specified.
#或者为 2376(当 --tls 开启时或 --tlsverify 已指定)。
-l, --log-level="debug|info|warn|error|fatal"
Set the logging level. Default is info.
#-l, --log-level="debug|info|warn|error|fatal": 设置日志级别。默认为 info。
--tls=true|false
Use TLS; implied by --tlsverify. Default is false.
#--tls=true|false: 使用 TLS 加密通信;当使用 --tlsverify 时,此选项会被隐式包含。默认为 false。
--tlscacert=~/.docker/ca.pem
Trust certs signed only by this CA.
#--tlscacert=~/.docker/ca.pem: 只信任由此 CA 签名的证书。
--tlscert=~/.docker/cert.pem
Path to TLS certificate file.
#--tlscert=~/.docker/cert.pem: TLS 证书文件的路径。
--tlskey=~/.docker/key.pem
Path to TLS key file.
#--tlskey=~/.docker/key.pem: TLS 密钥文件的路径。
--tlsverify=true|false
Use TLS and verify the remote (daemon: verify client, client: verify daemon).
#--tlsverify=true|false: 使用 TLS 并验证远程(守护进程:验证客户端,客户端:验证守护进程)。
Default is false.
#默认为 false。
-v, --version=true|false
Print version information and quit. Default is false
#-v, --version=true|false: 打印版本信息并退出。默认为 false。.
COMMANDS
Use "docker help" or "docker --help" to get an overview of available commands.
#这里的意思为使用 "docker help" 或 "docker --help" 可以获取可用命令的概述。
EXAMPLES #查看特定docker命令的示例
For specific client examples please see the man page for the specific Docker command. For example:
#为了查看特定 Docker 命令的客户端示例,请参阅该命令的手册页。例如:
#man docker [选项]
man docker-run
#使用 man docker-run 可以查看 docker run 命令的手册页,其中会提供有关如何使用该命令的详细说明和示例。
HISTORY
April 2014, Originally compiled by William Henry (whenry at redhat dot com) based on docker.com source material and internal work.
#此手册页最初编写于 2014 年 4 月。最初由 William Henry 编写。基于 docker.com 的源资料和内部工作。
Docker Community APRIL 2014