github.com/kunnos/engine@v1.13.1/man/docker-run.1.md (about)

     1  % DOCKER(1) Docker User Manuals
     2  % Docker Community
     3  % JUNE 2014
     4  # NAME
     5  docker-run - Run a command in a new container
     6  
     7  # SYNOPSIS
     8  **docker run**
     9  [**-a**|**--attach**[=*[]*]]
    10  [**--add-host**[=*[]*]]
    11  [**--blkio-weight**[=*[BLKIO-WEIGHT]*]]
    12  [**--blkio-weight-device**[=*[]*]]
    13  [**--cpu-shares**[=*0*]]
    14  [**--cap-add**[=*[]*]]
    15  [**--cap-drop**[=*[]*]]
    16  [**--cgroup-parent**[=*CGROUP-PATH*]]
    17  [**--cidfile**[=*CIDFILE*]]
    18  [**--cpu-count**[=*0*]]
    19  [**--cpu-percent**[=*0*]]
    20  [**--cpu-period**[=*0*]]
    21  [**--cpu-quota**[=*0*]]
    22  [**--cpu-rt-period**[=*0*]]
    23  [**--cpu-rt-runtime**[=*0*]]
    24  [**--cpus**[=*0.0*]]
    25  [**--cpuset-cpus**[=*CPUSET-CPUS*]]
    26  [**--cpuset-mems**[=*CPUSET-MEMS*]]
    27  [**-d**|**--detach**]
    28  [**--detach-keys**[=*[]*]]
    29  [**--device**[=*[]*]]
    30  [**--device-read-bps**[=*[]*]]
    31  [**--device-read-iops**[=*[]*]]
    32  [**--device-write-bps**[=*[]*]]
    33  [**--device-write-iops**[=*[]*]]
    34  [**--dns**[=*[]*]]
    35  [**--dns-option**[=*[]*]]
    36  [**--dns-search**[=*[]*]]
    37  [**-e**|**--env**[=*[]*]]
    38  [**--entrypoint**[=*ENTRYPOINT*]]
    39  [**--env-file**[=*[]*]]
    40  [**--expose**[=*[]*]]
    41  [**--group-add**[=*[]*]]
    42  [**-h**|**--hostname**[=*HOSTNAME*]]
    43  [**--help**]
    44  [**--init**]
    45  [**--init-path**[=*[]*]]
    46  [**-i**|**--interactive**]
    47  [**--ip**[=*IPv4-ADDRESS*]]
    48  [**--ip6**[=*IPv6-ADDRESS*]]
    49  [**--ipc**[=*IPC*]]
    50  [**--isolation**[=*default*]]
    51  [**--kernel-memory**[=*KERNEL-MEMORY*]]
    52  [**-l**|**--label**[=*[]*]]
    53  [**--label-file**[=*[]*]]
    54  [**--link**[=*[]*]]
    55  [**--link-local-ip**[=*[]*]]
    56  [**--log-driver**[=*[]*]]
    57  [**--log-opt**[=*[]*]]
    58  [**-m**|**--memory**[=*MEMORY*]]
    59  [**--mac-address**[=*MAC-ADDRESS*]]
    60  [**--memory-reservation**[=*MEMORY-RESERVATION*]]
    61  [**--memory-swap**[=*LIMIT*]]
    62  [**--memory-swappiness**[=*MEMORY-SWAPPINESS*]]
    63  [**--name**[=*NAME*]]
    64  [**--network-alias**[=*[]*]]
    65  [**--network**[=*"bridge"*]]
    66  [**--oom-kill-disable**]
    67  [**--oom-score-adj**[=*0*]]
    68  [**-P**|**--publish-all**]
    69  [**-p**|**--publish**[=*[]*]]
    70  [**--pid**[=*[PID]*]]
    71  [**--userns**[=*[]*]]
    72  [**--pids-limit**[=*PIDS_LIMIT*]]
    73  [**--privileged**]
    74  [**--read-only**]
    75  [**--restart**[=*RESTART*]]
    76  [**--rm**]
    77  [**--security-opt**[=*[]*]]
    78  [**--storage-opt**[=*[]*]]
    79  [**--stop-signal**[=*SIGNAL*]]
    80  [**--stop-timeout**[=*TIMEOUT*]]
    81  [**--shm-size**[=*[]*]]
    82  [**--sig-proxy**[=*true*]]
    83  [**--sysctl**[=*[]*]]
    84  [**-t**|**--tty**]
    85  [**--tmpfs**[=*[CONTAINER-DIR[:<OPTIONS>]*]]
    86  [**-u**|**--user**[=*USER*]]
    87  [**--ulimit**[=*[]*]]
    88  [**--uts**[=*[]*]]
    89  [**-v**|**--volume**[=*[[HOST-DIR:]CONTAINER-DIR[:OPTIONS]]*]]
    90  [**--volume-driver**[=*DRIVER*]]
    91  [**--volumes-from**[=*[]*]]
    92  [**-w**|**--workdir**[=*WORKDIR*]]
    93  IMAGE [COMMAND] [ARG...]
    94  
    95  # DESCRIPTION
    96  
    97  Run a process in a new container. **docker run** starts a process with its own
    98  file system, its own networking, and its own isolated process tree. The IMAGE
    99  which starts the process may define defaults related to the process that will be
   100  run in the container, the networking to expose, and more, but **docker run**
   101  gives final control to the operator or administrator who starts the container
   102  from the image. For that reason **docker run** has more options than any other
   103  Docker command.
   104  
   105  If the IMAGE is not already loaded then **docker run** will pull the IMAGE, and
   106  all image dependencies, from the repository in the same way running **docker
   107  pull** IMAGE, before it starts the container from that image.
   108  
   109  # OPTIONS
   110  **-a**, **--attach**=[]
   111     Attach to STDIN, STDOUT or STDERR.
   112  
   113     In foreground mode (the default when **-d**
   114  is not specified), **docker run** can start the process in the container
   115  and attach the console to the process's standard input, output, and standard
   116  error. It can even pretend to be a TTY (this is what most commandline
   117  executables expect) and pass along signals. The **-a** option can be set for
   118  each of stdin, stdout, and stderr.
   119  
   120  **--add-host**=[]
   121     Add a custom host-to-IP mapping (host:ip)
   122  
   123     Add a line to /etc/hosts. The format is hostname:ip.  The **--add-host**
   124  option can be set multiple times.
   125  
   126  **--blkio-weight**=*0*
   127     Block IO weight (relative weight) accepts a weight value between 10 and 1000.
   128  
   129  **--blkio-weight-device**=[]
   130     Block IO weight (relative device weight, format: `DEVICE_NAME:WEIGHT`).
   131  
   132  **--cpu-shares**=*0*
   133     CPU shares (relative weight)
   134  
   135     By default, all containers get the same proportion of CPU cycles. This proportion
   136  can be modified by changing the container's CPU share weighting relative
   137  to the weighting of all other running containers.
   138  
   139  To modify the proportion from the default of 1024, use the **--cpu-shares**
   140  flag to set the weighting to 2 or higher.
   141  
   142  The proportion will only apply when CPU-intensive processes are running.
   143  When tasks in one container are idle, other containers can use the
   144  left-over CPU time. The actual amount of CPU time will vary depending on
   145  the number of containers running on the system.
   146  
   147  For example, consider three containers, one has a cpu-share of 1024 and
   148  two others have a cpu-share setting of 512. When processes in all three
   149  containers attempt to use 100% of CPU, the first container would receive
   150  50% of the total CPU time. If you add a fourth container with a cpu-share
   151  of 1024, the first container only gets 33% of the CPU. The remaining containers
   152  receive 16.5%, 16.5% and 33% of the CPU.
   153  
   154  On a multi-core system, the shares of CPU time are distributed over all CPU
   155  cores. Even if a container is limited to less than 100% of CPU time, it can
   156  use 100% of each individual CPU core.
   157  
   158  For example, consider a system with more than three cores. If you start one
   159  container **{C0}** with **-c=512** running one process, and another container
   160  **{C1}** with **-c=1024** running two processes, this can result in the following
   161  division of CPU shares:
   162  
   163      PID    container	CPU	CPU share
   164      100    {C0}		0	100% of CPU0
   165      101    {C1}		1	100% of CPU1
   166      102    {C1}		2	100% of CPU2
   167  
   168  **--cap-add**=[]
   169     Add Linux capabilities
   170  
   171  **--cap-drop**=[]
   172     Drop Linux capabilities
   173  
   174  **--cgroup-parent**=""
   175     Path to cgroups under which the cgroup for the container will be created. If the path is not absolute, the path is considered to be relative to the cgroups path of the init process. Cgroups will be created if they do not already exist.
   176  
   177  **--cidfile**=""
   178     Write the container ID to the file
   179  
   180  **--cpu-count**=*0*
   181      Limit the number of CPUs available for execution by the container.
   182      
   183      On Windows Server containers, this is approximated as a percentage of total CPU usage.
   184  
   185      On Windows Server containers, the processor resource controls are mutually exclusive, the order of precedence is CPUCount first, then CPUShares, and CPUPercent last.
   186  
   187  **--cpu-percent**=*0*
   188      Limit the percentage of CPU available for execution by a container running on a Windows daemon.
   189  
   190      On Windows Server containers, the processor resource controls are mutually exclusive, the order of precedence is CPUCount first, then CPUShares, and CPUPercent last.
   191  
   192  **--cpu-period**=*0*
   193     Limit the CPU CFS (Completely Fair Scheduler) period
   194  
   195     Limit the container's CPU usage. This flag tell the kernel to restrict the container's CPU usage to the period you specify.
   196  
   197  **--cpuset-cpus**=""
   198     CPUs in which to allow execution (0-3, 0,1)
   199  
   200  **--cpuset-mems**=""
   201     Memory nodes (MEMs) in which to allow execution (0-3, 0,1). Only effective on NUMA systems.
   202  
   203     If you have four memory nodes on your system (0-3), use `--cpuset-mems=0,1`
   204  then processes in your Docker container will only use memory from the first
   205  two memory nodes.
   206  
   207  **--cpu-quota**=*0*
   208     Limit the CPU CFS (Completely Fair Scheduler) quota
   209  
   210     Limit the container's CPU usage. By default, containers run with the full
   211  CPU resource. This flag tell the kernel to restrict the container's CPU usage
   212  to the quota you specify.
   213  
   214  **--cpu-rt-period**=0
   215     Limit the CPU real-time period in microseconds
   216  
   217     Limit the container's Real Time CPU usage. This flag tell the kernel to restrict the container's Real Time CPU usage to the period you specify.
   218  
   219  **--cpu-rt-runtime**=0
   220     Limit the CPU real-time runtime in microseconds
   221  
   222     Limit the containers Real Time CPU usage. This flag tells the kernel to limit the amount of time in a given CPU period Real Time tasks may consume. Ex:
   223     Period of 1,000,000us and Runtime of 950,000us means that this container could consume 95% of available CPU and leave the remaining 5% to normal priority tasks.
   224  
   225     The sum of all runtimes across containers cannot exceed the amount allotted to the parent cgroup.
   226  
   227  **--cpus**=0.0
   228     Number of CPUs. The default is *0.0* which means no limit.
   229  
   230  **-d**, **--detach**=*true*|*false*
   231     Detached mode: run the container in the background and print the new container ID. The default is *false*.
   232  
   233     At any time you can run **docker ps** in
   234  the other shell to view a list of the running containers. You can reattach to a
   235  detached container with **docker attach**. If you choose to run a container in
   236  the detached mode, then you cannot use the **-rm** option.
   237  
   238     When attached in the tty mode, you can detach from the container (and leave it
   239  running) using a configurable key sequence. The default sequence is `CTRL-p CTRL-q`.
   240  You configure the key sequence using the **--detach-keys** option or a configuration file.
   241  See **config-json(5)** for documentation on using a configuration file.
   242  
   243  **--detach-keys**=""
   244     Override the key sequence for detaching a container. Format is a single character `[a-Z]` or `ctrl-<value>` where `<value>` is one of: `a-z`, `@`, `^`, `[`, `,` or `_`.
   245  
   246  **--device**=[]
   247     Add a host device to the container (e.g. --device=/dev/sdc:/dev/xvdc:rwm)
   248  
   249  **--device-read-bps**=[]
   250     Limit read rate from a device (e.g. --device-read-bps=/dev/sda:1mb)
   251  
   252  **--device-read-iops**=[]
   253     Limit read rate from a device (e.g. --device-read-iops=/dev/sda:1000)
   254  
   255  **--device-write-bps**=[]
   256     Limit write rate to a device (e.g. --device-write-bps=/dev/sda:1mb)
   257  
   258  **--device-write-iops**=[]
   259     Limit write rate to a device (e.g. --device-write-iops=/dev/sda:1000)
   260  
   261  **--dns-search**=[]
   262     Set custom DNS search domains (Use --dns-search=. if you don't wish to set the search domain)
   263  
   264  **--dns-option**=[]
   265     Set custom DNS options
   266  
   267  **--dns**=[]
   268     Set custom DNS servers
   269  
   270     This option can be used to override the DNS
   271  configuration passed to the container. Typically this is necessary when the
   272  host DNS configuration is invalid for the container (e.g., 127.0.0.1). When this
   273  is the case the **--dns** flags is necessary for every run.
   274  
   275  **-e**, **--env**=[]
   276     Set environment variables
   277  
   278     This option allows you to specify arbitrary
   279  environment variables that are available for the process that will be launched
   280  inside of the container.
   281  
   282  **--entrypoint**=""
   283     Overwrite the default ENTRYPOINT of the image
   284  
   285     This option allows you to overwrite the default entrypoint of the image that
   286  is set in the Dockerfile. The ENTRYPOINT of an image is similar to a COMMAND
   287  because it specifies what executable to run when the container starts, but it is
   288  (purposely) more difficult to override. The ENTRYPOINT gives a container its
   289  default nature or behavior, so that when you set an ENTRYPOINT you can run the
   290  container as if it were that binary, complete with default options, and you can
   291  pass in more options via the COMMAND. But, sometimes an operator may want to run
   292  something else inside the container, so you can override the default ENTRYPOINT
   293  at runtime by using a **--entrypoint** and a string to specify the new
   294  ENTRYPOINT.
   295  
   296  **--env-file**=[]
   297     Read in a line delimited file of environment variables
   298  
   299  **--expose**=[]
   300     Expose a port, or a range of ports (e.g. --expose=3300-3310) informs Docker
   301  that the container listens on the specified network ports at runtime. Docker
   302  uses this information to interconnect containers using links and to set up port
   303  redirection on the host system.
   304  
   305  **--group-add**=[]
   306     Add additional groups to run as
   307  
   308  **-h**, **--hostname**=""
   309     Container host name
   310  
   311     Sets the container host name that is available inside the container.
   312  
   313  **--help**
   314     Print usage statement
   315  
   316  **--init**
   317     Run an init inside the container that forwards signals and reaps processes
   318  
   319  **--init-path**=""
   320     Path to the docker-init binary
   321  
   322  **-i**, **--interactive**=*true*|*false*
   323     Keep STDIN open even if not attached. The default is *false*.
   324  
   325     When set to true, keep stdin open even if not attached. The default is false.
   326  
   327  **--ip**=""
   328     Sets the container's interface IPv4 address (e.g. 172.23.0.9)
   329  
   330     It can only be used in conjunction with **--network** for user-defined networks
   331  
   332  **--ip6**=""
   333     Sets the container's interface IPv6 address (e.g. 2001:db8::1b99)
   334  
   335     It can only be used in conjunction with **--network** for user-defined networks
   336  
   337  **--ipc**=""
   338     Default is to create a private IPC namespace (POSIX SysV IPC) for the container
   339                                 'container:<name|id>': reuses another container shared memory, semaphores and message queues
   340                                 'host': use the host shared memory,semaphores and message queues inside the container.  Note: the host mode gives the container full access to local shared memory and is therefore considered insecure.
   341  
   342  **--isolation**="*default*"
   343     Isolation specifies the type of isolation technology used by containers. Note
   344  that the default on Windows server is `process`, and the default on Windows client
   345  is `hyperv`. Linux only supports `default`.
   346  
   347  **-l**, **--label**=[]
   348     Set metadata on the container (e.g., --label com.example.key=value)
   349  
   350  **--kernel-memory**=""
   351     Kernel memory limit (format: `<number>[<unit>]`, where unit = b, k, m or g)
   352  
   353     Constrains the kernel memory available to a container. If a limit of 0
   354  is specified (not using `--kernel-memory`), the container's kernel memory
   355  is not limited. If you specify a limit, it may be rounded up to a multiple
   356  of the operating system's page size and the value can be very large,
   357  millions of trillions.
   358  
   359  **--label-file**=[]
   360     Read in a line delimited file of labels
   361  
   362  **--link**=[]
   363     Add link to another container in the form of <name or id>:alias or just <name or id>
   364  in which case the alias will match the name
   365  
   366     If the operator
   367  uses **--link** when starting the new client container, then the client
   368  container can access the exposed port via a private networking interface. Docker
   369  will set some environment variables in the client container to help indicate
   370  which interface and port to use.
   371  
   372  **--link-local-ip**=[]
   373     Add one or more link-local IPv4/IPv6 addresses to the container's interface
   374  
   375  **--log-driver**="*json-file*|*syslog*|*journald*|*gelf*|*fluentd*|*awslogs*|*splunk*|*etwlogs*|*gcplogs*|*none*"
   376    Logging driver for the container. Default is defined by daemon `--log-driver` flag.
   377    **Warning**: the `docker logs` command works only for the `json-file` and
   378    `journald` logging drivers.
   379  
   380  **--log-opt**=[]
   381    Logging driver specific options.
   382  
   383  **-m**, **--memory**=""
   384     Memory limit (format: <number>[<unit>], where unit = b, k, m or g)
   385  
   386     Allows you to constrain the memory available to a container. If the host
   387  supports swap memory, then the **-m** memory setting can be larger than physical
   388  RAM. If a limit of 0 is specified (not using **-m**), the container's memory is
   389  not limited. The actual limit may be rounded up to a multiple of the operating
   390  system's page size (the value would be very large, that's millions of trillions).
   391  
   392  **--memory-reservation**=""
   393     Memory soft limit (format: <number>[<unit>], where unit = b, k, m or g)
   394  
   395     After setting memory reservation, when the system detects memory contention
   396  or low memory, containers are forced to restrict their consumption to their
   397  reservation. So you should always set the value below **--memory**, otherwise the
   398  hard limit will take precedence. By default, memory reservation will be the same
   399  as memory limit.
   400  
   401  **--memory-swap**="LIMIT"
   402     A limit value equal to memory plus swap. Must be used with the  **-m**
   403  (**--memory**) flag. The swap `LIMIT` should always be larger than **-m**
   404  (**--memory**) value.  By default, the swap `LIMIT` will be set to double
   405  the value of --memory.
   406  
   407     The format of `LIMIT` is `<number>[<unit>]`. Unit can be `b` (bytes),
   408  `k` (kilobytes), `m` (megabytes), or `g` (gigabytes). If you don't specify a
   409  unit, `b` is used. Set LIMIT to `-1` to enable unlimited swap.
   410  
   411  **--mac-address**=""
   412     Container MAC address (e.g. 92:d0:c6:0a:29:33)
   413  
   414     Remember that the MAC address in an Ethernet network must be unique.
   415  The IPv6 link-local address will be based on the device's MAC address
   416  according to RFC4862.
   417  
   418  **--name**=""
   419     Assign a name to the container
   420  
   421     The operator can identify a container in three ways:
   422      UUID long identifier (“f78375b1c487e03c9438c729345e54db9d20cfa2ac1fc3494b6eb60872e74778”)
   423      UUID short identifier (“f78375b1c487”)
   424      Name (“jonah”)
   425  
   426     The UUID identifiers come from the Docker daemon, and if a name is not assigned
   427  to the container with **--name** then the daemon will also generate a random
   428  string name. The name is useful when defining links (see **--link**) (or any
   429  other place you need to identify a container). This works for both background
   430  and foreground Docker containers.
   431  
   432  **--network**="*bridge*"
   433     Set the Network mode for the container
   434                                 'bridge': create a network stack on the default Docker bridge
   435                                 'none': no networking
   436                                 'container:<name|id>': reuse another container's network stack
   437                                 'host': use the Docker host network stack. Note: the host mode gives the container full access to local system services such as D-bus and is therefore considered insecure.
   438                                 '<network-name>|<network-id>': connect to a user-defined network
   439  
   440  **--network-alias**=[]
   441     Add network-scoped alias for the container
   442  
   443  **--oom-kill-disable**=*true*|*false*
   444     Whether to disable OOM Killer for the container or not.
   445  
   446  **--oom-score-adj**=""
   447     Tune the host's OOM preferences for containers (accepts -1000 to 1000)
   448  
   449  **-P**, **--publish-all**=*true*|*false*
   450     Publish all exposed ports to random ports on the host interfaces. The default is *false*.
   451  
   452     When set to true publish all exposed ports to the host interfaces. The
   453  default is false. If the operator uses -P (or -p) then Docker will make the
   454  exposed port accessible on the host and the ports will be available to any
   455  client that can reach the host. When using -P, Docker will bind any exposed
   456  port to a random port on the host within an *ephemeral port range* defined by
   457  `/proc/sys/net/ipv4/ip_local_port_range`. To find the mapping between the host
   458  ports and the exposed ports, use `docker port`.
   459  
   460  **-p**, **--publish**=[]
   461     Publish a container's port, or range of ports, to the host.
   462  
   463     Format: `ip:hostPort:containerPort | ip::containerPort | hostPort:containerPort | containerPort`
   464  Both hostPort and containerPort can be specified as a range of ports.
   465  When specifying ranges for both, the number of container ports in the range must match the number of host ports in the range.
   466  (e.g., `docker run -p 1234-1236:1222-1224 --name thisWorks -t busybox`
   467  but not `docker run -p 1230-1236:1230-1240 --name RangeContainerPortsBiggerThanRangeHostPorts -t busybox`)
   468  With ip: `docker run -p 127.0.0.1:$HOSTPORT:$CONTAINERPORT --name CONTAINER -t someimage`
   469  Use `docker port` to see the actual mapping: `docker port CONTAINER $CONTAINERPORT`
   470  
   471  **--pid**=""
   472     Set the PID mode for the container
   473     Default is to create a private PID namespace for the container
   474                                 'container:<name|id>': join another container's PID namespace
   475                                 'host': use the host's PID namespace for the container. Note: the host mode gives the container full access to local PID and is therefore considered insecure.
   476  
   477  **--userns**=""
   478     Set the usernamespace mode for the container when `userns-remap` option is enabled.
   479       **host**: use the host usernamespace and enable all privileged options (e.g., `pid=host` or `--privileged`).
   480  
   481  **--pids-limit**=""
   482     Tune the container's pids limit. Set `-1` to have unlimited pids for the container.
   483  
   484  **--uts**=*host*
   485     Set the UTS mode for the container
   486       **host**: use the host's UTS namespace inside the container.
   487       Note: the host mode gives the container access to changing the host's hostname and is therefore considered insecure.
   488  
   489  **--privileged**=*true*|*false*
   490     Give extended privileges to this container. The default is *false*.
   491  
   492     By default, Docker containers are
   493  “unprivileged” (=false) and cannot, for example, run a Docker daemon inside the
   494  Docker container. This is because by default a container is not allowed to
   495  access any devices. A “privileged” container is given access to all devices.
   496  
   497     When the operator executes **docker run --privileged**, Docker will enable access
   498  to all devices on the host as well as set some configuration in AppArmor to
   499  allow the container nearly all the same access to the host as processes running
   500  outside of a container on the host.
   501  
   502  **--read-only**=*true*|*false*
   503     Mount the container's root filesystem as read only.
   504  
   505     By default a container will have its root filesystem writable allowing processes
   506  to write files anywhere.  By specifying the `--read-only` flag the container will have
   507  its root filesystem mounted as read only prohibiting any writes.
   508  
   509  **--restart**="*no*"
   510     Restart policy to apply when a container exits (no, on-failure[:max-retry], always, unless-stopped).
   511  
   512  **--rm**=*true*|*false*
   513     Automatically remove the container when it exits. The default is *false*.
   514     `--rm` flag can work together with `-d`, and auto-removal will be done on daemon side. Note that it's
   515  incompatible with any restart policy other than `none`.
   516  
   517  **--security-opt**=[]
   518     Security Options
   519  
   520      "label=user:USER"   : Set the label user for the container
   521      "label=role:ROLE"   : Set the label role for the container
   522      "label=type:TYPE"   : Set the label type for the container
   523      "label=level:LEVEL" : Set the label level for the container
   524      "label=disable"     : Turn off label confinement for the container
   525      "no-new-privileges" : Disable container processes from gaining additional privileges
   526  
   527      "seccomp=unconfined" : Turn off seccomp confinement for the container
   528      "seccomp=profile.json :  White listed syscalls seccomp Json file to be used as a seccomp filter
   529  
   530      "apparmor=unconfined" : Turn off apparmor confinement for the container
   531      "apparmor=your-profile" : Set the apparmor confinement profile for the container
   532  
   533  **--storage-opt**=[]
   534     Storage driver options per container
   535  
   536     $ docker run -it --storage-opt size=120G fedora /bin/bash
   537  
   538     This (size) will allow to set the container rootfs size to 120G at creation time.
   539     This option is only available for the `devicemapper`, `btrfs`, `overlay2`  and `zfs` graph drivers.
   540     For the `devicemapper`, `btrfs` and `zfs` storage drivers, user cannot pass a size less than the Default BaseFS Size.
   541     For the `overlay2` storage driver, the size option is only available if the backing fs is `xfs` and mounted with the `pquota` mount option.
   542     Under these conditions, user can pass any size less then the backing fs size.
   543  
   544  **--stop-signal**=*SIGTERM*
   545    Signal to stop a container. Default is SIGTERM.
   546  
   547  **--stop-timeout**=*10*
   548    Timeout (in seconds) to stop a container. Default is 10.
   549  
   550  **--shm-size**=""
   551     Size of `/dev/shm`. The format is `<number><unit>`.
   552     `number` must be greater than `0`.  Unit is optional and can be `b` (bytes), `k` (kilobytes), `m`(megabytes), or `g` (gigabytes).
   553     If you omit the unit, the system uses bytes. If you omit the size entirely, the system uses `64m`.
   554  
   555  **--sysctl**=SYSCTL
   556    Configure namespaced kernel parameters at runtime
   557  
   558    IPC Namespace - current sysctls allowed:
   559  
   560    kernel.msgmax, kernel.msgmnb, kernel.msgmni, kernel.sem, kernel.shmall, kernel.shmmax, kernel.shmmni, kernel.shm_rmid_forced
   561    Sysctls beginning with fs.mqueue.*
   562  
   563    If you use the `--ipc=host` option these sysctls will not be allowed.
   564  
   565    Network Namespace - current sysctls allowed:
   566        Sysctls beginning with net.*
   567  
   568    If you use the `--network=host` option these sysctls will not be allowed.
   569  
   570  **--sig-proxy**=*true*|*false*
   571     Proxy received signals to the process (non-TTY mode only). SIGCHLD, SIGSTOP, and SIGKILL are not proxied. The default is *true*.
   572  
   573  **--memory-swappiness**=""
   574     Tune a container's memory swappiness behavior. Accepts an integer between 0 and 100.
   575  
   576  **-t**, **--tty**=*true*|*false*
   577     Allocate a pseudo-TTY. The default is *false*.
   578  
   579     When set to true Docker can allocate a pseudo-tty and attach to the standard
   580  input of any container. This can be used, for example, to run a throwaway
   581  interactive shell. The default is false.
   582  
   583  The **-t** option is incompatible with a redirection of the docker client
   584  standard input.
   585  
   586  **--tmpfs**=[] Create a tmpfs mount
   587  
   588     Mount a temporary filesystem (`tmpfs`) mount into a container, for example:
   589  
   590     $ docker run -d --tmpfs /tmp:rw,size=787448k,mode=1777 my_image
   591  
   592     This command mounts a `tmpfs` at `/tmp` within the container.  The supported mount
   593  options are the same as the Linux default `mount` flags. If you do not specify
   594  any options, the systems uses the following options:
   595  `rw,noexec,nosuid,nodev,size=65536k`.
   596  
   597  **-u**, **--user**=""
   598     Sets the username or UID used and optionally the groupname or GID for the specified command.
   599  
   600     The followings examples are all valid:
   601     --user [user | user:group | uid | uid:gid | user:gid | uid:group ]
   602  
   603     Without this argument the command will be run as root in the container.
   604  
   605  **--ulimit**=[]
   606      Ulimit options
   607  
   608  **-v**|**--volume**[=*[[HOST-DIR:]CONTAINER-DIR[:OPTIONS]]*]
   609     Create a bind mount. If you specify, ` -v /HOST-DIR:/CONTAINER-DIR`, Docker
   610     bind mounts `/HOST-DIR` in the host to `/CONTAINER-DIR` in the Docker
   611     container. If 'HOST-DIR' is omitted,  Docker automatically creates the new
   612     volume on the host.  The `OPTIONS` are a comma delimited list and can be:
   613  
   614     * [rw|ro]
   615     * [z|Z]
   616     * [`[r]shared`|`[r]slave`|`[r]private`]
   617     * [nocopy]
   618  
   619  The `CONTAINER-DIR` must be an absolute path such as `/src/docs`. The `HOST-DIR`
   620  can be an absolute path or a `name` value. A `name` value must start with an
   621  alphanumeric character, followed by `a-z0-9`, `_` (underscore), `.` (period) or
   622  `-` (hyphen). An absolute path starts with a `/` (forward slash).
   623  
   624  If you supply a `HOST-DIR` that is an absolute path,  Docker bind-mounts to the
   625  path you specify. If you supply a `name`, Docker creates a named volume by that
   626  `name`. For example, you can specify either `/foo` or `foo` for a `HOST-DIR`
   627  value. If you supply the `/foo` value, Docker creates a bind-mount. If you
   628  supply the `foo` specification, Docker creates a named volume.
   629  
   630  You can specify multiple  **-v** options to mount one or more mounts to a
   631  container. To use these same mounts in other containers, specify the
   632  **--volumes-from** option also.
   633  
   634  You can add `:ro` or `:rw` suffix to a volume to mount it  read-only or
   635  read-write mode, respectively. By default, the volumes are mounted read-write.
   636  See examples.
   637  
   638  Labeling systems like SELinux require that proper labels are placed on volume
   639  content mounted into a container. Without a label, the security system might
   640  prevent the processes running inside the container from using the content. By
   641  default, Docker does not change the labels set by the OS.
   642  
   643  To change a label in the container context, you can add either of two suffixes
   644  `:z` or `:Z` to the volume mount. These suffixes tell Docker to relabel file
   645  objects on the shared volumes. The `z` option tells Docker that two containers
   646  share the volume content. As a result, Docker labels the content with a shared
   647  content label. Shared volume labels allow all containers to read/write content.
   648  The `Z` option tells Docker to label the content with a private unshared label.
   649  Only the current container can use a private volume.
   650  
   651  By default bind mounted volumes are `private`. That means any mounts done
   652  inside container will not be visible on host and vice-a-versa. One can change
   653  this behavior by specifying a volume mount propagation property. Making a
   654  volume `shared` mounts done under that volume inside container will be
   655  visible on host and vice-a-versa. Making a volume `slave` enables only one
   656  way mount propagation and that is mounts done on host under that volume
   657  will be visible inside container but not the other way around.
   658  
   659  To control mount propagation property of volume one can use `:[r]shared`,
   660  `:[r]slave` or `:[r]private` propagation flag. Propagation property can
   661  be specified only for bind mounted volumes and not for internal volumes or
   662  named volumes. For mount propagation to work source mount point (mount point
   663  where source dir is mounted on) has to have right propagation properties. For
   664  shared volumes, source mount point has to be shared. And for slave volumes,
   665  source mount has to be either shared or slave.
   666  
   667  Use `df <source-dir>` to figure out the source mount and then use
   668  `findmnt -o TARGET,PROPAGATION <source-mount-dir>` to figure out propagation
   669  properties of source mount. If `findmnt` utility is not available, then one
   670  can look at mount entry for source mount point in `/proc/self/mountinfo`. Look
   671  at `optional fields` and see if any propagaion properties are specified.
   672  `shared:X` means mount is `shared`, `master:X` means mount is `slave` and if
   673  nothing is there that means mount is `private`.
   674  
   675  To change propagation properties of a mount point use `mount` command. For
   676  example, if one wants to bind mount source directory `/foo` one can do
   677  `mount --bind /foo /foo` and `mount --make-private --make-shared /foo`. This
   678  will convert /foo into a `shared` mount point. Alternatively one can directly
   679  change propagation properties of source mount. Say `/` is source mount for
   680  `/foo`, then use `mount --make-shared /` to convert `/` into a `shared` mount.
   681  
   682  > **Note**:
   683  > When using systemd to manage the Docker daemon's start and stop, in the systemd
   684  > unit file there is an option to control mount propagation for the Docker daemon
   685  > itself, called `MountFlags`. The value of this setting may cause Docker to not
   686  > see mount propagation changes made on the mount point. For example, if this value
   687  > is `slave`, you may not be able to use the `shared` or `rshared` propagation on
   688  > a volume.
   689  
   690  To disable automatic copying of data from the container path to the volume, use
   691  the `nocopy` flag. The `nocopy` flag can be set on bind mounts and named volumes.
   692  
   693  **--volume-driver**=""
   694     Container's volume driver. This driver creates volumes specified either from
   695     a Dockerfile's `VOLUME` instruction or from the `docker run -v` flag.
   696     See **docker-volume-create(1)** for full details.
   697  
   698  **--volumes-from**=[]
   699     Mount volumes from the specified container(s)
   700  
   701     Mounts already mounted volumes from a source container onto another
   702     container. You must supply the source's container-id. To share
   703     a volume, use the **--volumes-from** option when running
   704     the target container. You can share volumes even if the source container
   705     is not running.
   706  
   707     By default, Docker mounts the volumes in the same mode (read-write or
   708     read-only) as it is mounted in the source container. Optionally, you
   709     can change this by suffixing the container-id with either the `:ro` or
   710     `:rw ` keyword.
   711  
   712     If the location of the volume from the source container overlaps with
   713     data residing on a target container, then the volume hides
   714     that data on the target.
   715  
   716  **-w**, **--workdir**=""
   717     Working directory inside the container
   718  
   719     The default working directory for
   720  running binaries within a container is the root directory (/). The developer can
   721  set a different default with the Dockerfile WORKDIR instruction. The operator
   722  can override the working directory by using the **-w** option.
   723  
   724  # Exit Status
   725  
   726  The exit code from `docker run` gives information about why the container
   727  failed to run or why it exited.  When `docker run` exits with a non-zero code,
   728  the exit codes follow the `chroot` standard, see below:
   729  
   730  **_125_** if the error is with Docker daemon **_itself_** 
   731  
   732      $ docker run --foo busybox; echo $?
   733      # flag provided but not defined: --foo
   734        See 'docker run --help'.
   735        125
   736  
   737  **_126_** if the **_contained command_** cannot be invoked
   738  
   739      $ docker run busybox /etc; echo $?
   740      # exec: "/etc": permission denied
   741        docker: Error response from daemon: Contained command could not be invoked
   742        126
   743  
   744  **_127_** if the **_contained command_** cannot be found
   745  
   746      $ docker run busybox foo; echo $?
   747      # exec: "foo": executable file not found in $PATH
   748        docker: Error response from daemon: Contained command not found or does not exist
   749        127
   750  
   751  **_Exit code_** of **_contained command_** otherwise 
   752      
   753      $ docker run busybox /bin/sh -c 'exit 3' 
   754      # 3
   755  
   756  # EXAMPLES
   757  
   758  ## Running container in read-only mode
   759  
   760  During container image development, containers often need to write to the image
   761  content.  Installing packages into /usr, for example.  In production,
   762  applications seldom need to write to the image.  Container applications write
   763  to volumes if they need to write to file systems at all.  Applications can be
   764  made more secure by running them in read-only mode using the --read-only switch.
   765  This protects the containers image from modification. Read only containers may
   766  still need to write temporary data.  The best way to handle this is to mount
   767  tmpfs directories on /run and /tmp.
   768  
   769      # docker run --read-only --tmpfs /run --tmpfs /tmp -i -t fedora /bin/bash
   770  
   771  ## Exposing log messages from the container to the host's log
   772  
   773  If you want messages that are logged in your container to show up in the host's
   774  syslog/journal then you should bind mount the /dev/log directory as follows.
   775  
   776      # docker run -v /dev/log:/dev/log -i -t fedora /bin/bash
   777  
   778  From inside the container you can test this by sending a message to the log.
   779  
   780      (bash)# logger "Hello from my container"
   781  
   782  Then exit and check the journal.
   783  
   784      # exit
   785  
   786      # journalctl -b | grep Hello
   787  
   788  This should list the message sent to logger.
   789  
   790  ## Attaching to one or more from STDIN, STDOUT, STDERR
   791  
   792  If you do not specify -a then Docker will attach everything (stdin,stdout,stderr)
   793  . You can specify to which of the three standard streams (stdin, stdout, stderr)
   794  you'd like to connect instead, as in:
   795  
   796      # docker run -a stdin -a stdout -i -t fedora /bin/bash
   797  
   798  ## Sharing IPC between containers
   799  
   800  Using shm_server.c available here: https://www.cs.cf.ac.uk/Dave/C/node27.html
   801  
   802  Testing `--ipc=host` mode:
   803  
   804  Host shows a shared memory segment with 7 pids attached, happens to be from httpd:
   805  
   806  ```
   807   $ sudo ipcs -m
   808  
   809   ------ Shared Memory Segments --------
   810   key        shmid      owner      perms      bytes      nattch     status      
   811   0x01128e25 0          root       600        1000       7                       
   812  ```
   813  
   814  Now run a regular container, and it correctly does NOT see the shared memory segment from the host:
   815  
   816  ```
   817   $ docker run -it shm ipcs -m
   818  
   819   ------ Shared Memory Segments --------
   820   key        shmid      owner      perms      bytes      nattch     status      
   821  ```
   822  
   823  Run a container with the new `--ipc=host` option, and it now sees the shared memory segment from the host httpd:
   824  
   825   ```
   826   $ docker run -it --ipc=host shm ipcs -m
   827  
   828   ------ Shared Memory Segments --------
   829   key        shmid      owner      perms      bytes      nattch     status      
   830   0x01128e25 0          root       600        1000       7                   
   831  ```
   832  Testing `--ipc=container:CONTAINERID` mode:
   833  
   834  Start a container with a program to create a shared memory segment:
   835  ```
   836   $ docker run -it shm bash
   837   $ sudo shm/shm_server &
   838   $ sudo ipcs -m
   839  
   840   ------ Shared Memory Segments --------
   841   key        shmid      owner      perms      bytes      nattch     status      
   842   0x0000162e 0          root       666        27         1                       
   843  ```
   844  Create a 2nd container correctly shows no shared memory segment from 1st container:
   845  ```
   846   $ docker run shm ipcs -m
   847  
   848   ------ Shared Memory Segments --------
   849   key        shmid      owner      perms      bytes      nattch     status      
   850  ```
   851  
   852  Create a 3rd container using the new --ipc=container:CONTAINERID option, now it shows the shared memory segment from the first:
   853  
   854  ```
   855   $ docker run -it --ipc=container:ed735b2264ac shm ipcs -m
   856   $ sudo ipcs -m
   857  
   858   ------ Shared Memory Segments --------
   859   key        shmid      owner      perms      bytes      nattch     status      
   860   0x0000162e 0          root       666        27         1
   861  ```
   862  
   863  ## Linking Containers
   864  
   865  > **Note**: This section describes linking between containers on the
   866  > default (bridge) network, also known as "legacy links". Using `--link`
   867  > on user-defined networks uses the DNS-based discovery, which does not add
   868  > entries to `/etc/hosts`, and does not set environment variables for
   869  > discovery.
   870  
   871  The link feature allows multiple containers to communicate with each other. For
   872  example, a container whose Dockerfile has exposed port 80 can be run and named
   873  as follows:
   874  
   875      # docker run --name=link-test -d -i -t fedora/httpd
   876  
   877  A second container, in this case called linker, can communicate with the httpd
   878  container, named link-test, by running with the **--link=<name>:<alias>**
   879  
   880      # docker run -t -i --link=link-test:lt --name=linker fedora /bin/bash
   881  
   882  Now the container linker is linked to container link-test with the alias lt.
   883  Running the **env** command in the linker container shows environment variables
   884   with the LT (alias) context (**LT_**)
   885  
   886      # env
   887      HOSTNAME=668231cb0978
   888      TERM=xterm
   889      LT_PORT_80_TCP=tcp://172.17.0.3:80
   890      LT_PORT_80_TCP_PORT=80
   891      LT_PORT_80_TCP_PROTO=tcp
   892      LT_PORT=tcp://172.17.0.3:80
   893      PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin
   894      PWD=/
   895      LT_NAME=/linker/lt
   896      SHLVL=1
   897      HOME=/
   898      LT_PORT_80_TCP_ADDR=172.17.0.3
   899      _=/usr/bin/env
   900  
   901  When linking two containers Docker will use the exposed ports of the container
   902  to create a secure tunnel for the parent to access.
   903  
   904  If a container is connected to the default bridge network and `linked`
   905  with other containers, then the container's `/etc/hosts` file is updated
   906  with the linked container's name.
   907  
   908  > **Note** Since Docker may live update the container's `/etc/hosts` file, there
   909  may be situations when processes inside the container can end up reading an
   910  empty or incomplete `/etc/hosts` file. In most cases, retrying the read again
   911  should fix the problem.
   912  
   913  
   914  ## Mapping Ports for External Usage
   915  
   916  The exposed port of an application can be mapped to a host port using the **-p**
   917  flag. For example, an httpd port 80 can be mapped to the host port 8080 using the
   918  following:
   919  
   920      # docker run -p 8080:80 -d -i -t fedora/httpd
   921  
   922  ## Creating and Mounting a Data Volume Container
   923  
   924  Many applications require the sharing of persistent data across several
   925  containers. Docker allows you to create a Data Volume Container that other
   926  containers can mount from. For example, create a named container that contains
   927  directories /var/volume1 and /tmp/volume2. The image will need to contain these
   928  directories so a couple of RUN mkdir instructions might be required for you
   929  fedora-data image:
   930  
   931      # docker run --name=data -v /var/volume1 -v /tmp/volume2 -i -t fedora-data true
   932      # docker run --volumes-from=data --name=fedora-container1 -i -t fedora bash
   933  
   934  Multiple --volumes-from parameters will bring together multiple data volumes from
   935  multiple containers. And it's possible to mount the volumes that came from the
   936  DATA container in yet another container via the fedora-container1 intermediary
   937  container, allowing to abstract the actual data source from users of that data:
   938  
   939      # docker run --volumes-from=fedora-container1 --name=fedora-container2 -i -t fedora bash
   940  
   941  ## Mounting External Volumes
   942  
   943  To mount a host directory as a container volume, specify the absolute path to
   944  the directory and the absolute path for the container directory separated by a
   945  colon:
   946  
   947      # docker run -v /var/db:/data1 -i -t fedora bash
   948  
   949  When using SELinux, be aware that the host has no knowledge of container SELinux
   950  policy. Therefore, in the above example, if SELinux policy is enforced, the
   951  `/var/db` directory is not writable to the container. A "Permission Denied"
   952  message will occur and an avc: message in the host's syslog.
   953  
   954  
   955  To work around this, at time of writing this man page, the following command
   956  needs to be run in order for the proper SELinux policy type label to be attached
   957  to the host directory:
   958  
   959      # chcon -Rt svirt_sandbox_file_t /var/db
   960  
   961  
   962  Now, writing to the /data1 volume in the container will be allowed and the
   963  changes will also be reflected on the host in /var/db.
   964  
   965  ## Using alternative security labeling
   966  
   967  You can override the default labeling scheme for each container by specifying
   968  the `--security-opt` flag. For example, you can specify the MCS/MLS level, a
   969  requirement for MLS systems. Specifying the level in the following command
   970  allows you to share the same content between containers.
   971  
   972      # docker run --security-opt label=level:s0:c100,c200 -i -t fedora bash
   973  
   974  An MLS example might be:
   975  
   976      # docker run --security-opt label=level:TopSecret -i -t rhel7 bash
   977  
   978  To disable the security labeling for this container versus running with the
   979  `--permissive` flag, use the following command:
   980  
   981      # docker run --security-opt label=disable -i -t fedora bash
   982  
   983  If you want a tighter security policy on the processes within a container,
   984  you can specify an alternate type for the container. You could run a container
   985  that is only allowed to listen on Apache ports by executing the following
   986  command:
   987  
   988      # docker run --security-opt label=type:svirt_apache_t -i -t centos bash
   989  
   990  Note:
   991  
   992  You would have to write policy defining a `svirt_apache_t` type.
   993  
   994  ## Setting device weight
   995  
   996  If you want to set `/dev/sda` device weight to `200`, you can specify the device
   997  weight by `--blkio-weight-device` flag. Use the following command:
   998  
   999     # docker run -it --blkio-weight-device "/dev/sda:200" ubuntu
  1000  
  1001  ## Specify isolation technology for container (--isolation)
  1002  
  1003  This option is useful in situations where you are running Docker containers on
  1004  Microsoft Windows. The `--isolation <value>` option sets a container's isolation
  1005  technology. On Linux, the only supported is the `default` option which uses
  1006  Linux namespaces. These two commands are equivalent on Linux:
  1007  
  1008  ```
  1009  $ docker run -d busybox top
  1010  $ docker run -d --isolation default busybox top
  1011  ```
  1012  
  1013  On Microsoft Windows, can take any of these values:
  1014  
  1015  * `default`: Use the value specified by the Docker daemon's `--exec-opt` . If the `daemon` does not specify an isolation technology, Microsoft Windows uses `process` as its default value.
  1016  * `process`: Namespace isolation only.
  1017  * `hyperv`: Hyper-V hypervisor partition-based isolation.
  1018  
  1019  In practice, when running on Microsoft Windows without a `daemon` option set,  these two commands are equivalent:
  1020  
  1021  ```
  1022  $ docker run -d --isolation default busybox top
  1023  $ docker run -d --isolation process busybox top
  1024  ```
  1025  
  1026  If you have set the `--exec-opt isolation=hyperv` option on the Docker `daemon`, any of these commands also result in `hyperv` isolation:
  1027  
  1028  ```
  1029  $ docker run -d --isolation default busybox top
  1030  $ docker run -d --isolation hyperv busybox top
  1031  ```
  1032  
  1033  ## Setting Namespaced Kernel Parameters (Sysctls)
  1034  
  1035  The `--sysctl` sets namespaced kernel parameters (sysctls) in the
  1036  container. For example, to turn on IP forwarding in the containers
  1037  network namespace, run this command:
  1038  
  1039      $ docker run --sysctl net.ipv4.ip_forward=1 someimage
  1040  
  1041  Note:
  1042  
  1043  Not all sysctls are namespaced. Docker does not support changing sysctls
  1044  inside of a container that also modify the host system. As the kernel 
  1045  evolves we expect to see more sysctls become namespaced.
  1046  
  1047  See the definition of the `--sysctl` option above for the current list of 
  1048  supported sysctls.
  1049  
  1050  # HISTORY
  1051  April 2014, Originally compiled by William Henry (whenry at redhat dot com)
  1052  based on docker.com source material and internal work.
  1053  June 2014, updated by Sven Dowideit <SvenDowideit@home.org.au>
  1054  July 2014, updated by Sven Dowideit <SvenDowideit@home.org.au>
  1055  November 2015, updated by Sally O'Malley <somalley@redhat.com>