github.com/endocode/docker@v1.4.2-0.20160113120958-46eb4700391e/docs/reference/commandline/run.md (about)

     1  <!--[metadata]>
     2  +++
     3  title = "run"
     4  description = "The run command description and usage"
     5  keywords = ["run, command, container"]
     6  [menu.main]
     7  parent = "smn_cli"
     8  +++
     9  <![end-metadata]-->
    10  
    11  # run
    12  
    13      Usage: docker run [OPTIONS] IMAGE [COMMAND] [ARG...]
    14  
    15      Run a command in a new container
    16  
    17        -a, --attach=[]               Attach to STDIN, STDOUT or STDERR
    18        --add-host=[]                 Add a custom host-to-IP mapping (host:ip)
    19        --blkio-weight=0              Block IO weight (relative weight)
    20        --blkio-weight-device=[]      Block IO weight (relative device weight, format: `DEVICE_NAME:WEIGHT`)
    21        --cpu-shares=0                CPU shares (relative weight)
    22        --cap-add=[]                  Add Linux capabilities
    23        --cap-drop=[]                 Drop Linux capabilities
    24        --cgroup-parent=""            Optional parent cgroup for the container
    25        --cidfile=""                  Write the container ID to the file
    26        --cpu-period=0                Limit CPU CFS (Completely Fair Scheduler) period
    27        --cpu-quota=0                 Limit CPU CFS (Completely Fair Scheduler) quota
    28        --cpuset-cpus=""              CPUs in which to allow execution (0-3, 0,1)
    29        --cpuset-mems=""              Memory nodes (MEMs) in which to allow execution (0-3, 0,1)
    30        -d, --detach                  Run container in background and print container ID
    31        --detach-keys                 Specify the escape key sequence used to detach a container
    32        --device=[]                   Add a host device to the container
    33        --device-read-bps=[]          Limit read rate (bytes per second) from a device (e.g., --device-read-bps=/dev/sda:1mb)
    34        --device-read-iops=[]         Limit read rate (IO per second) from a device (e.g., --device-read-iops=/dev/sda:1000)
    35        --device-write-bps=[]         Limit write rate (bytes per second) to a device (e.g., --device-write-bps=/dev/sda:1mb)
    36        --device-write-iops=[]        Limit write rate (IO per second) to a device (e.g., --device-write-bps=/dev/sda:1000)
    37        --disable-content-trust=true  Skip image verification
    38        --dns=[]                      Set custom DNS servers
    39        --dns-opt=[]                  Set custom DNS options
    40        --dns-search=[]               Set custom DNS search domains
    41        -e, --env=[]                  Set environment variables
    42        --entrypoint=""               Overwrite the default ENTRYPOINT of the image
    43        --env-file=[]                 Read in a file of environment variables
    44        --expose=[]                   Expose a port or a range of ports
    45        --group-add=[]                Add additional groups to run as
    46        -h, --hostname=""             Container host name
    47        --help                        Print usage
    48        -i, --interactive             Keep STDIN open even if not attached
    49        --ipc=""                      IPC namespace to use
    50        --isolation=""                Container isolation technology
    51        --kernel-memory=""            Kernel memory limit
    52        -l, --label=[]                Set metadata on the container (e.g., --label=com.example.key=value)
    53        --label-file=[]               Read in a file of labels (EOL delimited)
    54        --link=[]                     Add link to another container
    55        --log-driver=""               Logging driver for container
    56        --log-opt=[]                  Log driver specific options
    57        -m, --memory=""               Memory limit
    58        --mac-address=""              Container MAC address (e.g. 92:d0:c6:0a:29:33)
    59        --ip=""                       Container IPv4 address (e.g. 172.30.100.104)
    60        --ip6=""                      Container IPv6 address (e.g. 2001:db8::33)
    61        --memory-reservation=""       Memory soft limit
    62        --memory-swap=""              A positive integer equal to memory plus swap. Specify -1 to enable unlimited swap.
    63        --memory-swappiness=""        Tune a container's memory swappiness behavior. Accepts an integer between 0 and 100.
    64        --name=""                     Assign a name to the container
    65        --net="bridge"                Connect a container to a network
    66                                      'bridge': create a network stack on the default Docker bridge
    67                                      'none': no networking
    68                                      'container:<name|id>': reuse another container's network stack
    69                                      'host': use the Docker host network stack
    70                                      '<network-name>|<network-id>': connect to a user-defined network
    71        --oom-kill-disable            Whether to disable OOM Killer for the container or not
    72        --oom-score-adj=0             Tune the host's OOM preferences for containers (accepts -1000 to 1000)
    73        -P, --publish-all             Publish all exposed ports to random ports
    74        -p, --publish=[]              Publish a container's port(s) to the host
    75        --pid=""                      PID namespace to use
    76        --privileged                  Give extended privileges to this container
    77        --read-only                   Mount the container's root filesystem as read only
    78        --restart="no"                Restart policy (no, on-failure[:max-retry], always, unless-stopped)
    79        --rm                          Automatically remove the container when it exits
    80        --shm-size=[]                 Size of `/dev/shm`. The format is `<number><unit>`. `number` must be greater than `0`.  Unit is optional and can be `b` (bytes), `k` (kilobytes), `m` (megabytes), or `g` (gigabytes). If you omit the unit, the system uses bytes. If you omit the size entirely, the system uses `64m`.
    81        --security-opt=[]             Security Options
    82        --sig-proxy=true              Proxy received signals to the process
    83        --stop-signal="SIGTERM"       Signal to stop a container
    84        -t, --tty                     Allocate a pseudo-TTY
    85        -u, --user=""                 Username or UID (format: <name|uid>[:<group|gid>])
    86        --ulimit=[]                   Ulimit options
    87        --uts=""                      UTS namespace to use
    88        -v, --volume=[host-src:]container-dest[:<options>]
    89                                      Bind mount a volume. The comma-delimited
    90                                      `options` are [rw|ro], [z|Z], or
    91                                      [[r]shared|[r]slave|[r]private]. The
    92                                      'host-src' is an absolute path or a name
    93                                      value.
    94        --volume-driver=""            Container's volume driver
    95        --volumes-from=[]             Mount volumes from the specified container(s)
    96        -w, --workdir=""              Working directory inside the container
    97  
    98  The `docker run` command first `creates` a writeable container layer over the
    99  specified image, and then `starts` it using the specified command. That is,
   100  `docker run` is equivalent to the API `/containers/create` then
   101  `/containers/(id)/start`. A stopped container can be restarted with all its
   102  previous changes intact using `docker start`. See `docker ps -a` to view a list
   103  of all containers.
   104  
   105  The `docker run` command can be used in combination with `docker commit` to
   106  [*change the command that a container runs*](commit.md). There is additional detailed information about `docker run` in the [Docker run reference](../run.md).
   107  
   108  For information on connecting a container to a network, see the ["*Docker network overview*"](../../userguide/networking/index.md).
   109  
   110  ## Examples
   111  
   112  ### Assign name and allocate psuedo-TTY (--name, -it)
   113  
   114      $ docker run --name test -it debian
   115      root@d6c0fe130dba:/# exit 13
   116      $ echo $?
   117      13
   118      $ docker ps -a | grep test
   119      d6c0fe130dba        debian:7            "/bin/bash"         26 seconds ago      Exited (13) 17 seconds ago                         test
   120  
   121  This example runs a container named `test` using the `debian:latest`
   122  image. The `-it` instructs Docker to allocate a pseudo-TTY connected to
   123  the container's stdin; creating an interactive `bash` shell in the container.
   124  In the example, the `bash` shell is quit by entering
   125  `exit 13`. This exit code is passed on to the caller of
   126  `docker run`, and is recorded in the `test` container's metadata.
   127  
   128  ### Capture container ID (--cidfile)
   129  
   130      $ docker run --cidfile /tmp/docker_test.cid ubuntu echo "test"
   131  
   132  This will create a container and print `test` to the console. The `cidfile`
   133  flag makes Docker attempt to create a new file and write the container ID to it.
   134  If the file exists already, Docker will return an error. Docker will close this
   135  file when `docker run` exits.
   136  
   137  ### Full container capabilities (--privileged)
   138  
   139      $ docker run -t -i --rm ubuntu bash
   140      root@bc338942ef20:/# mount -t tmpfs none /mnt
   141      mount: permission denied
   142  
   143  This will *not* work, because by default, most potentially dangerous kernel
   144  capabilities are dropped; including `cap_sys_admin` (which is required to mount
   145  filesystems). However, the `--privileged` flag will allow it to run:
   146  
   147      $ docker run --privileged ubuntu bash
   148      root@50e3f57e16e6:/# mount -t tmpfs none /mnt
   149      root@50e3f57e16e6:/# df -h
   150      Filesystem      Size  Used Avail Use% Mounted on
   151      none            1.9G     0  1.9G   0% /mnt
   152  
   153  The `--privileged` flag gives *all* capabilities to the container, and it also
   154  lifts all the limitations enforced by the `device` cgroup controller. In other
   155  words, the container can then do almost everything that the host can do. This
   156  flag exists to allow special use-cases, like running Docker within Docker.
   157  
   158  ### Set working directory (-w)
   159  
   160      $ docker  run -w /path/to/dir/ -i -t  ubuntu pwd
   161  
   162  The `-w` lets the command being executed inside directory given, here
   163  `/path/to/dir/`. If the path does not exists it is created inside the container.
   164  
   165  ### mount tmpfs (--tmpfs)
   166  
   167      $ docker run -d --tmpfs /run:rw,noexec,nosuid,size=65536k my_image
   168  
   169      The --tmpfs flag mounts a tmpfs into the container with the rw,noexec,nosuid,size=65536k options.
   170  
   171      Underlying content from the /run in the my_image image is copied into tmpfs.
   172  
   173  ### Mount volume (-v, --read-only)
   174  
   175      $ docker  run  -v `pwd`:`pwd` -w `pwd` -i -t  ubuntu pwd
   176  
   177  The `-v` flag mounts the current working directory into the container. The `-w`
   178  lets the command being executed inside the current working directory, by
   179  changing into the directory to the value returned by `pwd`. So this
   180  combination executes the command using the container, but inside the
   181  current working directory.
   182  
   183      $ docker run -v /doesnt/exist:/foo -w /foo -i -t ubuntu bash
   184  
   185  When the host directory of a bind-mounted volume doesn't exist, Docker
   186  will automatically create this directory on the host for you. In the
   187  example above, Docker will create the `/doesnt/exist`
   188  folder before starting your container.
   189  
   190      $ docker run --read-only -v /icanwrite busybox touch /icanwrite here
   191  
   192  Volumes can be used in combination with `--read-only` to control where
   193  a container writes files. The `--read-only` flag mounts the container's root
   194  filesystem as read only prohibiting writes to locations other than the
   195  specified volumes for the container.
   196  
   197      $ docker run -t -i -v /var/run/docker.sock:/var/run/docker.sock -v ./static-docker:/usr/bin/docker busybox sh
   198  
   199  By bind-mounting the docker unix socket and statically linked docker
   200  binary (such as that provided by [https://get.docker.com](
   201  https://get.docker.com)), you give the container the full access to create and
   202  manipulate the host's Docker daemon.
   203  
   204  ### Publish or expose port (-p, --expose)
   205  
   206      $ docker run -p 127.0.0.1:80:8080 ubuntu bash
   207  
   208  This binds port `8080` of the container to port `80` on `127.0.0.1` of the host
   209  machine. The [Docker User
   210  Guide](../../userguide/networking/default_network/dockerlinks.md)
   211  explains in detail how to manipulate ports in Docker.
   212  
   213      $ docker run --expose 80 ubuntu bash
   214  
   215  This exposes port `80` of the container without publishing the port to the host
   216  system's interfaces.
   217  
   218  ### Set environment variables (-e, --env, --env-file)
   219  
   220      $ docker run -e MYVAR1 --env MYVAR2=foo --env-file ./env.list ubuntu bash
   221  
   222  This sets environmental variables in the container. For illustration all three
   223  flags are shown here. Where `-e`, `--env` take an environment variable and
   224  value, or if no `=` is provided, then that variable's current value is passed
   225  through (i.e. `$MYVAR1` from the host is set to `$MYVAR1` in the container).
   226  When no `=` is provided and that variable is not defined in the client's
   227  environment then that variable will be removed from the container's list of
   228  environment variables.
   229  All three flags, `-e`, `--env` and `--env-file` can be repeated.
   230  
   231  Regardless of the order of these three flags, the `--env-file` are processed
   232  first, and then `-e`, `--env` flags. This way, the `-e` or `--env` will
   233  override variables as needed.
   234  
   235      $ cat ./env.list
   236      TEST_FOO=BAR
   237      $ docker run --env TEST_FOO="This is a test" --env-file ./env.list busybox env | grep TEST_FOO
   238      TEST_FOO=This is a test
   239  
   240  The `--env-file` flag takes a filename as an argument and expects each line
   241  to be in the `VAR=VAL` format, mimicking the argument passed to `--env`. Comment
   242  lines need only be prefixed with `#`
   243  
   244  An example of a file passed with `--env-file`
   245  
   246      $ cat ./env.list
   247      TEST_FOO=BAR
   248  
   249      # this is a comment
   250      TEST_APP_DEST_HOST=10.10.0.127
   251      TEST_APP_DEST_PORT=8888
   252      _TEST_BAR=FOO
   253      TEST_APP_42=magic
   254      helloWorld=true
   255      123qwe=bar
   256      org.spring.config=something
   257  
   258      # pass through this variable from the caller
   259      TEST_PASSTHROUGH
   260      $ TEST_PASSTHROUGH=howdy docker run --env-file ./env.list busybox env
   261      PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin
   262      HOSTNAME=5198e0745561
   263      TEST_FOO=BAR
   264      TEST_APP_DEST_HOST=10.10.0.127
   265      TEST_APP_DEST_PORT=8888
   266      _TEST_BAR=FOO
   267      TEST_APP_42=magic
   268      helloWorld=true
   269      TEST_PASSTHROUGH=howdy
   270      HOME=/root
   271      123qwe=bar
   272      org.spring.config=something
   273  
   274      $ docker run --env-file ./env.list busybox env
   275      PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin
   276      HOSTNAME=5198e0745561
   277      TEST_FOO=BAR
   278      TEST_APP_DEST_HOST=10.10.0.127
   279      TEST_APP_DEST_PORT=8888
   280      _TEST_BAR=FOO
   281      TEST_APP_42=magic
   282      helloWorld=true
   283      TEST_PASSTHROUGH=
   284      HOME=/root
   285      123qwe=bar
   286      org.spring.config=something
   287  
   288  ### Set metadata on container (-l, --label, --label-file)
   289  
   290  A label is a `key=value` pair that applies metadata to a container. To label a container with two labels:
   291  
   292      $ docker run -l my-label --label com.example.foo=bar ubuntu bash
   293  
   294  The `my-label` key doesn't specify a value so the label defaults to an empty
   295  string(`""`). To add multiple labels, repeat the label flag (`-l` or `--label`).
   296  
   297  The `key=value` must be unique to avoid overwriting the label value. If you
   298  specify labels with identical keys but different values, each subsequent value
   299  overwrites the previous. Docker uses the last `key=value` you supply.
   300  
   301  Use the `--label-file` flag to load multiple labels from a file. Delimit each
   302  label in the file with an EOL mark. The example below loads labels from a
   303  labels file in the current directory:
   304  
   305      $ docker run --label-file ./labels ubuntu bash
   306  
   307  The label-file format is similar to the format for loading environment
   308  variables. (Unlike environment variables, labels are not visible to processes
   309  running inside a container.) The following example illustrates a label-file
   310  format:
   311  
   312      com.example.label1="a label"
   313  
   314      # this is a comment
   315      com.example.label2=another\ label
   316      com.example.label3
   317  
   318  You can load multiple label-files by supplying multiple  `--label-file` flags.
   319  
   320  For additional information on working with labels, see [*Labels - custom
   321  metadata in Docker*](../../userguide/labels-custom-metadata.md) in the Docker User
   322  Guide.
   323  
   324  ### Connect a container to a network (--net)
   325  
   326  When you start a container use the `--net` flag to connect it to a network.
   327  This adds the `busybox` container to the `mynet` network.
   328  
   329  ```bash
   330  $ docker run -itd --net=my-multihost-network busybox
   331  ```
   332  
   333  If you want to add a running container to a network use the `docker network connect` subcommand.
   334  
   335  You can connect multiple containers to the same network. Once connected, the
   336  containers can communicate easily need only another container's IP address
   337  or name. For `overlay` networks or custom plugins that support multi-host
   338  connectivity, containers connected to the same multi-host network but launched
   339  from different Engines can also communicate in this way.
   340  
   341  **Note**: Service discovery is unavailable on the default bridge network.
   342  Containers can communicate via their IP addresses by default. To communicate
   343  by name, they must be linked.
   344  
   345  You can disconnect a container from a network using the `docker network
   346  disconnect` command.
   347  
   348  ### Mount volumes from container (--volumes-from)
   349  
   350      $ docker run --volumes-from 777f7dc92da7 --volumes-from ba8c0c54f0f2:ro -i -t ubuntu pwd
   351  
   352  The `--volumes-from` flag mounts all the defined volumes from the referenced
   353  containers. Containers can be specified by repetitions of the `--volumes-from`
   354  argument. The container ID may be optionally suffixed with `:ro` or `:rw` to
   355  mount the volumes in read-only or read-write mode, respectively. By default,
   356  the volumes are mounted in the same mode (read write or read only) as
   357  the reference container.
   358  
   359  Labeling systems like SELinux require that proper labels are placed on volume
   360  content mounted into a container. Without a label, the security system might
   361  prevent the processes running inside the container from using the content. By
   362  default, Docker does not change the labels set by the OS.
   363  
   364  To change the label in the container context, you can add either of two suffixes
   365  `:z` or `:Z` to the volume mount. These suffixes tell Docker to relabel file
   366  objects on the shared volumes. The `z` option tells Docker that two containers
   367  share the volume content. As a result, Docker labels the content with a shared
   368  content label. Shared volume labels allow all containers to read/write content.
   369  The `Z` option tells Docker to label the content with a private unshared label.
   370  Only the current container can use a private volume.
   371  
   372  ### Attach to STDIN/STDOUT/STDERR (-a)
   373  
   374  The `-a` flag tells `docker run` to bind to the container's `STDIN`, `STDOUT`
   375  or `STDERR`. This makes it possible to manipulate the output and input as
   376  needed.
   377  
   378      $ echo "test" | docker run -i -a stdin ubuntu cat -
   379  
   380  This pipes data into a container and prints the container's ID by attaching
   381  only to the container's `STDIN`.
   382  
   383      $ docker run -a stderr ubuntu echo test
   384  
   385  This isn't going to print anything unless there's an error because we've
   386  only attached to the `STDERR` of the container. The container's logs
   387  still store what's been written to `STDERR` and `STDOUT`.
   388  
   389      $ cat somefile | docker run -i -a stdin mybuilder dobuild
   390  
   391  This is how piping a file into a container could be done for a build.
   392  The container's ID will be printed after the build is done and the build
   393  logs could be retrieved using `docker logs`. This is
   394  useful if you need to pipe a file or something else into a container and
   395  retrieve the container's ID once the container has finished running.
   396  
   397  ### Add host device to container (--device)
   398  
   399      $ docker run --device=/dev/sdc:/dev/xvdc --device=/dev/sdd --device=/dev/zero:/dev/nulo -i -t ubuntu ls -l /dev/{xvdc,sdd,nulo}
   400      brw-rw---- 1 root disk 8, 2 Feb  9 16:05 /dev/xvdc
   401      brw-rw---- 1 root disk 8, 3 Feb  9 16:05 /dev/sdd
   402      crw-rw-rw- 1 root root 1, 5 Feb  9 16:05 /dev/nulo
   403  
   404  It is often necessary to directly expose devices to a container. The `--device`
   405  option enables that. For example, a specific block storage device or loop
   406  device or audio device can be added to an otherwise unprivileged container
   407  (without the `--privileged` flag) and have the application directly access it.
   408  
   409  By default, the container will be able to `read`, `write` and `mknod` these devices.
   410  This can be overridden using a third `:rwm` set of options to each `--device`
   411  flag:
   412  
   413  
   414      $ docker run --device=/dev/sda:/dev/xvdc --rm -it ubuntu fdisk  /dev/xvdc
   415  
   416      Command (m for help): q
   417      $ docker run --device=/dev/sda:/dev/xvdc:ro --rm -it ubuntu fdisk  /dev/xvdc
   418      You will not be able to write the partition table.
   419  
   420      Command (m for help): q
   421  
   422      $ docker run --device=/dev/sda:/dev/xvdc --rm -it ubuntu fdisk  /dev/xvdc
   423  
   424      Command (m for help): q
   425  
   426      $ docker run --device=/dev/sda:/dev/xvdc:m --rm -it ubuntu fdisk  /dev/xvdc
   427      fdisk: unable to open /dev/xvdc: Operation not permitted
   428  
   429  > **Note:**
   430  > `--device` cannot be safely used with ephemeral devices. Block devices
   431  > that may be removed should not be added to untrusted containers with
   432  > `--device`.
   433  
   434  ### Restart policies (--restart)
   435  
   436  Use Docker's `--restart` to specify a container's *restart policy*. A restart
   437  policy controls whether the Docker daemon restarts a container after exit.
   438  Docker supports the following restart policies:
   439  
   440  <table>
   441    <thead>
   442      <tr>
   443        <th>Policy</th>
   444        <th>Result</th>
   445      </tr>
   446    </thead>
   447    <tbody>
   448      <tr>
   449        <td><strong>no</strong></td>
   450        <td>
   451          Do not automatically restart the container when it exits. This is the
   452          default.
   453        </td>
   454      </tr>
   455      <tr>
   456        <td>
   457          <span style="white-space: nowrap">
   458            <strong>on-failure</strong>[:max-retries]
   459          </span>
   460        </td>
   461        <td>
   462          Restart only if the container exits with a non-zero exit status.
   463          Optionally, limit the number of restart retries the Docker
   464          daemon attempts.
   465        </td>
   466      </tr>
   467      <tr>
   468        <td><strong>always</strong></td>
   469        <td>
   470          Always restart the container regardless of the exit status.
   471          When you specify always, the Docker daemon will try to restart
   472          the container indefinitely. The container will also always start
   473          on daemon startup, regardless of the current state of the container.
   474        </td>
   475      </tr>
   476      <tr>
   477        <td><strong>unless-stopped</strong></td>
   478        <td>
   479          Always restart the container regardless of the exit status, but
   480          do not start it on daemon startup if the container has been put
   481          to a stopped state before.
   482        </td>
   483      </tr>
   484    </tbody>
   485  </table>
   486  
   487      $ docker run --restart=always redis
   488  
   489  This will run the `redis` container with a restart policy of **always**
   490  so that if the container exits, Docker will restart it.
   491  
   492  More detailed information on restart policies can be found in the
   493  [Restart Policies (--restart)](../run.md#restart-policies-restart)
   494  section of the Docker run reference page.
   495  
   496  ### Add entries to container hosts file (--add-host)
   497  
   498  You can add other hosts into a container's `/etc/hosts` file by using one or
   499  more `--add-host` flags. This example adds a static address for a host named
   500  `docker`:
   501  
   502      $ docker run --add-host=docker:10.180.0.1 --rm -it debian
   503      $$ ping docker
   504      PING docker (10.180.0.1): 48 data bytes
   505      56 bytes from 10.180.0.1: icmp_seq=0 ttl=254 time=7.600 ms
   506      56 bytes from 10.180.0.1: icmp_seq=1 ttl=254 time=30.705 ms
   507      ^C--- docker ping statistics ---
   508      2 packets transmitted, 2 packets received, 0% packet loss
   509      round-trip min/avg/max/stddev = 7.600/19.152/30.705/11.553 ms
   510  
   511  Sometimes you need to connect to the Docker host from within your
   512  container. To enable this, pass the Docker host's IP address to
   513  the container using the `--add-host` flag. To find the host's address,
   514  use the `ip addr show` command.
   515  
   516  The flags you pass to `ip addr show` depend on whether you are
   517  using IPv4 or IPv6 networking in your containers. Use the following
   518  flags for IPv4 address retrieval for a network device named `eth0`:
   519  
   520      $ HOSTIP=`ip -4 addr show scope global dev eth0 | grep inet | awk '{print \$2}' | cut -d / -f 1`
   521      $ docker run  --add-host=docker:${HOSTIP} --rm -it debian
   522  
   523  For IPv6 use the `-6` flag instead of the `-4` flag. For other network
   524  devices, replace `eth0` with the correct device name (for example `docker0`
   525  for the bridge device).
   526  
   527  ### Set ulimits in container (--ulimit)
   528  
   529  Since setting `ulimit` settings in a container requires extra privileges not
   530  available in the default container, you can set these using the `--ulimit` flag.
   531  `--ulimit` is specified with a soft and hard limit as such:
   532  `<type>=<soft limit>[:<hard limit>]`, for example:
   533  
   534      $ docker run --ulimit nofile=1024:1024 --rm debian ulimit -n
   535      1024
   536  
   537  > **Note:**
   538  > If you do not provide a `hard limit`, the `soft limit` will be used
   539  > for both values. If no `ulimits` are set, they will be inherited from
   540  > the default `ulimits` set on the daemon.  `as` option is disabled now.
   541  > In other words, the following script is not supported:
   542  > `$ docker run -it --ulimit as=1024 fedora /bin/bash`
   543  
   544  The values are sent to the appropriate `syscall` as they are set.
   545  Docker doesn't perform any byte conversion. Take this into account when setting the values.
   546  
   547  #### For `nproc` usage
   548  
   549  Be careful setting `nproc` with the `ulimit` flag as `nproc` is designed by Linux to set the
   550  maximum number of processes available to a user, not to a container.  For example, start four
   551  containers with `daemon` user:
   552  
   553      docker run -d -u daemon --ulimit nproc=3 busybox top
   554      docker run -d -u daemon --ulimit nproc=3 busybox top
   555      docker run -d -u daemon --ulimit nproc=3 busybox top
   556      docker run -d -u daemon --ulimit nproc=3 busybox top
   557  
   558  The 4th container fails and reports "[8] System error: resource temporarily unavailable" error.
   559  This fails because the caller set `nproc=3` resulting in the first three containers using up
   560  the three processes quota set for the `daemon` user.
   561  
   562  ### Stop container with signal (--stop-signal)
   563  
   564  The `--stop-signal` flag sets the system call signal that will be sent to the container to exit.
   565  This signal can be a valid unsigned number that matches a position in the kernel's syscall table, for instance 9,
   566  or a signal name in the format SIGNAME, for instance SIGKILL.
   567  
   568  ### Specify isolation technology for container (--isolation)
   569  
   570  This option is useful in situations where you are running Docker containers on
   571  Microsoft Windows. The `--isolation <value>` option sets a container's isolation
   572  technology. On Linux, the only supported is the `default` option which uses
   573  Linux namespaces. These two commands are equivalent on Linux:
   574  
   575  ```
   576  $ docker run -d busybox top
   577  $ docker run -d --isolation default busybox top
   578  ```
   579  
   580  On Microsoft Windows, can take any of these values:
   581  
   582  
   583  | Value     | Description                                                                                                                                                   |
   584  |-----------|---------------------------------------------------------------------------------------------------------------------------------------------------------------|
   585  | `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.  |
   586  | `process` | Namespace isolation only.                                                                                                                                     |
   587  | `hyperv`   | Hyper-V hypervisor partition-based isolation.                                                                                                                  |
   588  
   589  In practice, when running on Microsoft Windows without a `daemon` option set,  these two commands are equivalent:
   590  
   591  ```
   592  $ docker run -d --isolation default busybox top
   593  $ docker run -d --isolation process busybox top
   594  ```
   595  
   596  If you have set the `--exec-opt isolation=hyperv` option on the Docker `daemon`, any of these commands also result in `hyperv` isolation:
   597  
   598  ```
   599  $ docker run -d --isolation default busybox top
   600  $ docker run -d --isolation hyperv busybox top
   601  ```