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 []) 描述参数
问题一
-a, --attach list
表示这两个option
是一样的作用,即
docker run -a list
和docker run --attach list
是一样的作用,-c, --cpu-shares int
也是如此问题二
看完上一个问题,你应该知道
option
选项有一个即可,所以docker run --attach list
是正确的,并且docker run -a list
也可以达到同样的效果