[root@localhost ~]# docker run --help
Usage: docker run [OPTIONS]IMAGE[COMMAND][ARG...]
Create and run a newcontainer from an image
Aliases:
docker container run, docker run
Options:--add-host list Add a custom host-to-IPmapping(host:ip) ## 添加自定义的主机到IP的映射。
--annotation map Add an annotation to the container(passed through to the OCI runtime)(default map[])
## 为容器添加注解,这些注解会传递给OCI运行时。
-a,--attach list Attach to STDIN,STDOUT or STDERR
## 附加到容器的标准输入、标准输出或标准错误。
--blkio-weight uint16 Block IO(relative weight), between
10 and 1000, or 0 to disable(default0)
## 设置块IO的相对权重,范围在10到1000之间,或者设置为0禁用。
--blkio-weight-device list Block IOweight(relative device
weight)(default[])
## 设置块IO设备的相对权重。
--cap-add list Add Linux capabilities ## 添加Linux能力。
--cap-drop list Drop Linux capabilities ## 删除Linux能力。
--cgroup-parent string Optional parent cgroup for the container
## 为容器设置可选的父cgroup。
--cgroupns string Cgroup namespace to use(host|private)'host': Run the container in the
Docker host's cgroup namespace
'private': Run the container in its
own private cgroup namespace
'': Use the cgroup namespace
as configured by the
default-cgroupns-mode
option on the daemon(default)
## 设置cgroup命名空间的使用方式,可以是host(使用Docker主机的cgroup命名空间)或private(使用容器自己的私有cgroup命名空间)。
--cidfile string Write the container ID to the file
## 将容器ID写入指定的文件。
--cpu-period int Limit CPUCFS(Completely Fair
Scheduler) period
## 限制CPU的CFS(完全公平调度器)周期。
--cpu-quota int Limit CPUCFS(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 CPUshares(relative weight)
## 设置CPU的相对权重(共享)。
--cpus decimal Number of CPUs
## 设置容器可以使用的CPU数量。
--cpuset-cpus string CPUs in which to allow execution(0-3,0,1)
## 分别设置允许执行的CPU。
--cpuset-mems string MEMs in which to allow execution(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(defaulttrue)
## 跳过镜像验证(默认启用)。
--dns list Set custom DNS servers
## 设置自定义DNS服务器。
--dns-option list Set DNS options
## 设置DNS选项。
--dns-search list Set custom DNS search domains
## 设置自定义DNS搜索域。
--domainname string Container NIS domain name
## 设置容器的NIS域名。
--entrypoint string Overwrite the defaultENTRYPOINTof
the image
## 覆盖镜像的默认ENTRYPOINT。
-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
## 暴露一个端口或一个端口范围。
--gpus gpu-request GPU devices to add to the container('all' to pass all GPUs)
## 向容器中添加GPU设备('all'表示传递所有GPU)。
--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)
## 运行检查之间的时间间隔(单位:毫秒|秒|分钟|小时),默认0秒。
--health-retries int Consecutive failures needed to
report unhealthy
## 连续失败次数达到此值后报告不健康状态。
--health-start-interval duration Time between running the check
during the start period(ms|s|m|h)(default 0s)
## 启动期间运行检查的时间间隔(单位同上),默认0秒。
--health-start-period duration Start period for the container to
initialize before starting
health-retries countdown(ms|s|m|h)(default 0s)
## 容器初始化并开始健康重试倒计时的启动期(单位同上),默认0秒。
--health-timeout duration Maximum time to allow one check to
run(ms|s|m|h)(default 0s)
## 允许单个检查运行的最大时间(单位同上),默认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
## 即使未附加也保持STDIN打开。
--ip string IPv4 address(e.g.,172.30.100.104)
## IPv4地址(例如,172.30.100.104)。
--ip6 string IPv6 address(e.g.,2001:db8::33)
## IPv6地址(例如,2001:db8::33)。
--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
## 容器的IPv4/IPv6链路本地地址。
--log-driver string Logging driver for the container
## 容器的日志驱动程序。
--log-opt list Log driver options
## 日志驱动程序选项。
--mac-address string Container MACaddress(e.g.,92:d0:c6:0a:29:33)
## 容器的MAC地址(例如,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
## 内存加交换的限制,设置为-1以启用无限交换。
--memory-swappiness int Tune container memory swappiness(0
to 100)(default-1)
## 调整容器的内存交换性(0到100),默认-1。
--mount mount Attach a filesystem mount to the
container
## 将文件系统挂载附加到容器。
--name string Assign a name to the container
## 为容器分配一个名称。
--network network Connect a container to a network
## 将容器连接到网络。
--network-alias list Add network-scoped alias for the
container
## 为容器添加网络范围别名。
--no-healthcheck Disable any container-specified
HEALTHCHECK
## 禁用容器指定的HEALTHCHECK。
--oom-kill-disable Disable OOM Killer
## 禁用OOM杀手。
--oom-score-adj int Tune host's OOMpreferences(-1000
to 1000)
## 调整主机的OOM偏好(-1000到1000)。
--pid string PID namespace to use
## 要使用的PID命名空间。
--pids-limit int Tune container pids limit(set -1for unlimited)
## 调整容器的PID限制(设置为-1表示无限制)。
--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
## 将容器的端口(s)发布到主机。
-P,--publish-all Publish all exposed ports to random
ports
## 将所有暴露的端口发布到随机端口。
--pull string Pull image before running("always","missing","never")(default"missing")
## 在运行前拉取镜像("always","missing","never"),默认"missing"。
-q,--quiet Suppress the pull output
## 抑制拉取输出。
--read-only Mount the container's root
filesystem as read only
## 将容器的根文件系统挂载为只读。
--restart string Restart policy to apply when a
container exits(default"no")
## 容器退出时要应用的重启策略(默认"no")。
--rm Automatically remove the container
and its associated anonymous
volumes when it exits
## 容器退出时自动删除容器及其关联的匿名卷。
--runtime string Runtime to use forthis container
## 此容器要使用的运行时。
--security-opt list Security Options
## 安全选项。
--shm-size bytes Size of/dev/shm
## /dev/shm的大小。
--sig-proxy Proxy received signals to the
process(defaulttrue)
## 将接收到的信号代理到进程(默认true)。
--stop-signal string Signal to stop the container
## 停止容器的信号。
--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选项(默认map[])。
--tmpfs list Mount a tmpfs directory
## 挂载一个tmpfs目录。
-t,--tty Allocate a pseudo-TTY
## 分配一个伪TTY。
--ulimit ulimit Ulimit options(default[])
## Ulimit选项(默认[])。
-u,--user string Username or UID(format:<name|uid>[:<group|gid>])
## 用户名或UID(格式:<name|uid>[:<group|gid>])。
--userns string User namespace to use
## 要使用的用户命名空间。
--uts string UTS namespace to use
## 要使用的UTS命名空间。
-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)
## 从指定的容器(s)挂载卷。
-w,--workdir string Working directory inside the container
## 容器内的工作目录。
2、logs 命令
docker logs --help
Usage: docker logs [OPTIONS]CONTAINER
Fetch the logs of a container
Aliases:
docker container logs, docker logs
Options:--details Show extra details provided to logs
## 显示更多的信息
-f,--follow Follow log output
## 跟踪实时日志
--since string Show logs since timestamp(e.g."2013-01-02T13:23:37Z") or relative(e.g."42m"for42 minutes)
## 显示自某个timestamp之后的日志,或相对时间,如42m(即42分钟)
-n,--tail string Number of lines to show from the end of the logs(default"all")
## 从日志末尾显示多少行日志, 默认是all
-t,--timestamps Show timestamps
## 显示时间戳
--until string Show logs before a timestamp(e.g."2013-01-02T13:23:37Z") or relative(e.g."42m"for42 minutes)
## 显示自某个timestamp之前的日志,或相对时间,如42m(即42分钟)
3、ps 命令
docker ps --help
Usage: docker ps [OPTIONS]
List containers
Aliases:
docker container ls, docker container list, docker container ps, docker ps
Options:-a,--all Show all containers(default shows just running)
## 显示所有容器(默认只显示正在运行的容器)。
-f,--filter filter Filter output based on conditions provided
## 基于提供的条件过滤输出。
--format string Format output using a custom template:
## 使用自定义模板格式化输出。模板可以是:
'table': Print output in table format with
column headers(default)
## 以表格格式打印输出,包含列标题(默认)。
'table TEMPLATE': Print output in table format using
the given Go template
## 使用给定的Go模板以表格格式打印输出。
'json': Print inJSON format
## 以JSON格式打印输出。
'TEMPLATE': Print output using the given Go
template.
## 使用给定的Go模板打印输出。
Refer to https://docs.docker.com/go/formatting/for more
information about formatting output with templates
## 更多关于使用模板格式化输出的信息,请参考Docker官方文档。
-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 container IDs
## 仅显示容器ID。
-s,--size Display total file sizes
## 显示总文件大小。
4、volume 命令
docker volume --help
Usage: docker volume COMMAND
Manage volumes
Commands:
create Create a volume
## 创建一个新的卷。
inspect Display detailed information on one or more volumes
## 显示一个或多个卷的详细信息。
ls List volumes
## 列出所有的卷。
prune Remove unused local volumes
## 删除未使用的本地卷。
rm Remove one or more volumes
## 删除一个或多个卷。
5、images 命令
docker images --help
Usage: docker images [OPTIONS][REPOSITORY[:TAG]]
List images
Aliases:
docker image ls, docker image list, docker images
Options:-a,--all Show all images(default hides intermediate images)
## 显示所有镜像(默认情况下会隐藏中间层镜像)
--digests Show digests
## 显示镜像的摘要信息。
-f,--filter filter Filter output based on conditions provided
## 根据提供的条件过滤输出结果。
--format string Format output using a custom template:
## 使用自定义模板格式化输出。可选的模板类型包括:
'table': Print output in table format with column headers(default)
## 以表格格式打印输出,包含列标题(默认)。
'table TEMPLATE': Print output in table format using the given Go template
## 使用给定的 Go 模板以表格格式打印输出。
'json': Print inJSON format
## 以 JSON 格式打印输出。
'TEMPLATE': Print output using the given Go template.
## 使用给定的 Go 模板打印输出。
Refer to https://docs.docker.com/go/formatting/for more
information about formatting output with templates
## 关于如何使用模板格式化输出,可以参考 Docker 文档中的格式化部分。
--no-trunc Don't truncate output
## 不截断输出信息。
-q,--quiet Only show image IDs
## 仅显示镜像ID。