liunx 命令中的参数每一列表示是什么意思?

docker run 通过 --help可以使用参数

root@iZ2zecxzfewu856w8sll6dZ:/home/docker/docker-php# docker run --help

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) (default [])
  -a, --attach list                           Attach to STDIN, STDOUT or STDERR (default [])
      --blkio-weight uint16                   Block IO (relative weight), between 10 and 1000, or 0 to disable (default 0)
      --blkio-weight-device weighted-device   Block IO weight (relative device weight) (default [])
      --cap-add list                          Add Linux capabilities (default [])
      --cap-drop list                         Drop Linux capabilities (default [])
      --cgroup-parent string                  Optional parent cgroup for the container
      --cidfile string                        Write the container ID to the file
      --cpu-count int                         CPU count (Windows only)
      --cpu-percent int                       CPU percent (Windows only)
      --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 CPU real-time period in microseconds
      --cpu-rt-runtime int                    Limit CPU real-time runtime in microseconds
  -c, --cpu-shares int                        CPU shares (relative weight)
      --cpus decimal                          Number of CPUs (default 0.000)
      --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)
      --credentialspec string                 Credential spec for managed service account (Windows only)
  -d, --detach                                Run container in background and print container ID

由上面抽取一行

-a, --attach list                           Attach to STDIN, STDOUT or STDERR (default [])

然后每一列表示什么

-a 表示什么?

-- attach 表示什么?

list 表示什么?

Attach to STDIN, STDOUT or STDERR (default []) 描述参数

阅读 3.6k
3 个回答

问题一

-a, --attach list 表示这两个option是一样的作用,
docker run -a listdocker run --attach list是一样的作用,
-c, --cpu-shares int也是如此

问题二

看完上一个问题,你应该知道option选项有一个即可,所以docker run --attach list是正确的,并且docker run -a list也可以达到同样的效果

docker run能够在容器启动进程并附着控制台到进程的标准输入,输出和标准错误,-a--attach是一样的的选项,一个是简称,一个是全称罢了,list表示附着标准流的列表,可以从三个标准流(STDIN, STDOUT, STDERR)指定你想连接的标准流,默认docker将附着所有标准流。

dokcer run -a list

docker run --attach list 都对

Options:
      --add-host list                         Add a custom host-to-IP mapping (host:ip) (default [])
  -a, --attach list                           Attach to STDIN, STDOUT or STDERR (default [])

-a [参数简写, 如果前面没有侧无简写]

--attach [参数全称]

list [返回类型]

Attach to STDIN, STDOUT or STDERR (default []) [参数解释]

撰写回答
你尚未登录,登录后可以
  • 和开发者交流问题的细节
  • 关注并接收问题和回答的更新提醒
  • 参与内容的编辑和改进,让解决方法与时俱进
推荐问题