github.com/chenchun/docker@v1.3.2-0.20150629222414-20467faf132b/docs/reference/run.md (about) 1 <!--[metadata]> 2 +++ 3 title = "Docker run reference" 4 description = "Configure containers at runtime" 5 keywords = ["docker, run, configure, runtime"] 6 [menu.main] 7 parent = "mn_reference" 8 +++ 9 <![end-metadata]--> 10 11 <!-- TODO (@thaJeztah) define more flexible table/td classes --> 12 <style> 13 .content-body table .no-wrap { 14 white-space: nowrap; 15 } 16 </style> 17 # Docker run reference 18 19 **Docker runs processes in isolated containers**. When an operator 20 executes `docker run`, she starts a process with its own file system, 21 its own networking, and its own isolated process tree. The 22 [*Image*](/terms/image/#image) which starts the process may define 23 defaults related to the binary to run, the networking to expose, and 24 more, but `docker run` gives final control to the operator who starts 25 the container from the image. That's the main reason 26 [*run*](/reference/commandline/cli/#run) has more options than any 27 other `docker` command. 28 29 ## General form 30 31 The basic `docker run` command takes this form: 32 33 $ docker run [OPTIONS] IMAGE[:TAG|@DIGEST] [COMMAND] [ARG...] 34 35 To learn how to interpret the types of `[OPTIONS]`, 36 see [*Option types*](/reference/commandline/cli/#option-types). 37 38 The `run` options control the image's runtime behavior in a container. These 39 settings affect: 40 41 * detached or foreground running 42 * container identification 43 * network settings 44 * runtime constraints on CPU and memory 45 * privileges and LXC configuration 46 47 An image developer may set defaults for these same settings when they create the 48 image using the `docker build` command. Operators, however, can override all 49 defaults set by the developer using the `run` options. And, operators can also 50 override nearly all the defaults set by the Docker runtime itself. 51 52 Finally, depending on your Docker system configuration, you may be required to 53 preface each `docker` command with `sudo`. To avoid having to use `sudo` with 54 the `docker` command, your system administrator can create a Unix group called 55 `docker` and add users to it. For more information about this configuration, 56 refer to the Docker installation documentation for your operating system. 57 58 ## Operator exclusive options 59 60 Only the operator (the person executing `docker run`) can set the 61 following options. 62 63 - [Detached vs Foreground](#detached-vs-foreground) 64 - [Detached (-d)](#detached-d) 65 - [Foreground](#foreground) 66 - [Container Identification](#container-identification) 67 - [Name (--name)](#name-name) 68 - [PID Equivalent](#pid-equivalent) 69 - [IPC Settings (--ipc)](#ipc-settings-ipc) 70 - [Network Settings](#network-settings) 71 - [Restart Policies (--restart)](#restart-policies-restart) 72 - [Clean Up (--rm)](#clean-up-rm) 73 - [Runtime Constraints on CPU and Memory](#runtime-constraints-on-cpu-and-memory) 74 - [Runtime Privilege, Linux Capabilities, and LXC Configuration](#runtime-privilege-linux-capabilities-and-lxc-configuration) 75 76 ## Detached vs foreground 77 78 When starting a Docker container, you must first decide if you want to 79 run the container in the background in a "detached" mode or in the 80 default foreground mode: 81 82 -d=false: Detached mode: Run container in the background, print new container id 83 84 ### Detached (-d) 85 86 In detached mode (`-d=true` or just `-d`), all I/O should be done 87 through network connections or shared volumes because the container is 88 no longer listening to the command line where you executed `docker run`. 89 You can reattach to a detached container with `docker` 90 [*attach*](/reference/commandline/cli/#attach). If you choose to run a 91 container in the detached mode, then you cannot use the `--rm` option. 92 93 ### Foreground 94 95 In foreground mode (the default when `-d` is not specified), `docker 96 run` can start the process in the container and attach the console to 97 the process's standard input, output, and standard error. It can even 98 pretend to be a TTY (this is what most command line executables expect) 99 and pass along signals. All of that is configurable: 100 101 -a=[] : Attach to `STDIN`, `STDOUT` and/or `STDERR` 102 -t=false : Allocate a pseudo-tty 103 --sig-proxy=true: Proxify all received signal to the process (non-TTY mode only) 104 -i=false : Keep STDIN open even if not attached 105 106 If you do not specify `-a` then Docker will [attach all standard 107 streams]( https://github.com/docker/docker/blob/ 108 75a7f4d90cde0295bcfb7213004abce8d4779b75/commands.go#L1797). You can 109 specify to which of the three standard streams (`STDIN`, `STDOUT`, 110 `STDERR`) you'd like to connect instead, as in: 111 112 $ docker run -a stdin -a stdout -i -t ubuntu /bin/bash 113 114 For interactive processes (like a shell), you must use `-i -t` together in 115 order to allocate a tty for the container process. `-i -t` is often written `-it` 116 as you'll see in later examples. Specifying `-t` is forbidden when the client 117 standard output is redirected or piped, such as in: 118 `echo test | docker run -i busybox cat`. 119 120 >**Note**: A process running as PID 1 inside a container is treated 121 >specially by Linux: it ignores any signal with the default action. 122 >So, the process will not terminate on `SIGINT` or `SIGTERM` unless it is 123 >coded to do so. 124 125 ## Container identification 126 127 ### Name (--name) 128 129 The operator can identify a container in three ways: 130 131 - UUID long identifier 132 ("f78375b1c487e03c9438c729345e54db9d20cfa2ac1fc3494b6eb60872e74778") 133 - UUID short identifier ("f78375b1c487") 134 - Name ("evil_ptolemy") 135 136 The UUID identifiers come from the Docker daemon, and if you do not 137 assign a name to the container with `--name` then the daemon will also 138 generate a random string name too. The name can become a handy way to 139 add meaning to a container since you can use this name when defining 140 [*links*](/userguide/dockerlinks) (or any 141 other place you need to identify a container). This works for both 142 background and foreground Docker containers. 143 144 ### PID equivalent 145 146 Finally, to help with automation, you can have Docker write the 147 container ID out to a file of your choosing. This is similar to how some 148 programs might write out their process ID to a file (you've seen them as 149 PID files): 150 151 --cidfile="": Write the container ID to the file 152 153 ### Image[:tag] 154 155 While not strictly a means of identifying a container, you can specify a version of an 156 image you'd like to run the container with by adding `image[:tag]` to the command. For 157 example, `docker run ubuntu:14.04`. 158 159 ### Image[@digest] 160 161 Images using the v2 or later image format have a content-addressable identifier 162 called a digest. As long as the input used to generate the image is unchanged, 163 the digest value is predictable and referenceable. 164 165 ## PID settings (--pid) 166 167 --pid="" : Set the PID (Process) Namespace mode for the container, 168 'host': use the host's PID namespace inside the container 169 170 By default, all containers have the PID namespace enabled. 171 172 PID namespace provides separation of processes. The PID Namespace removes the 173 view of the system processes, and allows process ids to be reused including 174 pid 1. 175 176 In certain cases you want your container to share the host's process namespace, 177 basically allowing processes within the container to see all of the processes 178 on the system. For example, you could build a container with debugging tools 179 like `strace` or `gdb`, but want to use these tools when debugging processes 180 within the container. 181 182 $ docker run --pid=host rhel7 strace -p 1234 183 184 This command would allow you to use `strace` inside the container on pid 1234 on 185 the host. 186 187 ## UTS settings (--uts) 188 189 --uts="" : Set the UTS namespace mode for the container, 190 'host': use the host's UTS namespace inside the container 191 192 The UTS namespace is for setting the hostname and the domain that is visible 193 to running processes in that namespace. By default, all containers, including 194 those with `--net=host`, have their own UTS namespace. The `host` setting will 195 result in the container using the same UTS namespace as the host. 196 197 You may wish to share the UTS namespace with the host if you would like the 198 hostname of the container to change as the hostname of the host changes. A 199 more advanced use case would be changing the host's hostname from a container. 200 201 > **Note**: `--uts="host"` gives the container full access to change the 202 > hostname of the host and is therefore considered insecure. 203 204 ## IPC settings (--ipc) 205 206 --ipc="" : Set the IPC mode for the container, 207 'container:<name|id>': reuses another container's IPC namespace 208 'host': use the host's IPC namespace inside the container 209 210 By default, all containers have the IPC namespace enabled. 211 212 IPC (POSIX/SysV IPC) namespace provides separation of named shared memory 213 segments, semaphores and message queues. 214 215 Shared memory segments are used to accelerate inter-process communication at 216 memory speed, rather than through pipes or through the network stack. Shared 217 memory is commonly used by databases and custom-built (typically C/OpenMPI, 218 C++/using boost libraries) high performance applications for scientific 219 computing and financial services industries. If these types of applications 220 are broken into multiple containers, you might need to share the IPC mechanisms 221 of the containers. 222 223 ## Network settings 224 225 --dns=[] : Set custom dns servers for the container 226 --net="bridge" : Set the Network mode for the container 227 'bridge': creates a new network stack for the container on the docker bridge 228 'none': no networking for this container 229 'container:<name|id>': reuses another container network stack 230 'host': use the host network stack inside the container 231 --add-host="" : Add a line to /etc/hosts (host:IP) 232 --mac-address="" : Sets the container's Ethernet device's MAC address 233 234 By default, all containers have networking enabled and they can make any 235 outgoing connections. The operator can completely disable networking 236 with `docker run --net none` which disables all incoming and outgoing 237 networking. In cases like this, you would perform I/O through files or 238 `STDIN` and `STDOUT` only. 239 240 Your container will use the same DNS servers as the host by default, but 241 you can override this with `--dns`. 242 243 By default, the MAC address is generated using the IP address allocated to the 244 container. You can set the container's MAC address explicitly by providing a 245 MAC address via the `--mac-address` parameter (format:`12:34:56:78:9a:bc`). 246 247 Supported networking modes are: 248 249 <table> 250 <thead> 251 <tr> 252 <th class="no-wrap">Mode</th> 253 <th>Description</th> 254 </tr> 255 </thead> 256 <tbody> 257 <tr> 258 <td class="no-wrap"><strong>none</strong></td> 259 <td> 260 No networking in the container. 261 </td> 262 </tr> 263 <tr> 264 <td class="no-wrap"><strong>bridge</strong> (default)</td> 265 <td> 266 Connect the container to the bridge via veth interfaces. 267 </td> 268 </tr> 269 <tr> 270 <td class="no-wrap"><strong>host</strong></td> 271 <td> 272 Use the host's network stack inside the container. 273 </td> 274 </tr> 275 <tr> 276 <td class="no-wrap"><strong>container</strong>:<name|id></td> 277 <td> 278 Use the network stack of another container, specified via 279 its *name* or *id*. 280 </td> 281 </tr> 282 </tbody> 283 </table> 284 285 #### Mode: none 286 287 With the networking mode set to `none` a container will not have a 288 access to any external routes. The container will still have a 289 `loopback` interface enabled in the container but it does not have any 290 routes to external traffic. 291 292 #### Mode: bridge 293 294 With the networking mode set to `bridge` a container will use docker's 295 default networking setup. A bridge is setup on the host, commonly named 296 `docker0`, and a pair of `veth` interfaces will be created for the 297 container. One side of the `veth` pair will remain on the host attached 298 to the bridge while the other side of the pair will be placed inside the 299 container's namespaces in addition to the `loopback` interface. An IP 300 address will be allocated for containers on the bridge's network and 301 traffic will be routed though this bridge to the container. 302 303 #### Mode: host 304 305 With the networking mode set to `host` a container will share the host's 306 network stack and all interfaces from the host will be available to the 307 container. The container's hostname will match the hostname on the host 308 system. Publishing ports and linking to other containers will not work 309 when sharing the host's network stack. Note that `--add-host` `--hostname` 310 `--dns` `--dns-search` and `--mac-address` is invalid in `host` netmode. 311 312 Compared to the default `bridge` mode, the `host` mode gives *significantly* 313 better networking performance since it uses the host's native networking stack 314 whereas the bridge has to go through one level of virtualization through the 315 docker daemon. It is recommended to run containers in this mode when their 316 networking performance is critical, for example, a production Load Balancer 317 or a High Performance Web Server. 318 319 > **Note**: `--net="host"` gives the container full access to local system 320 > services such as D-bus and is therefore considered insecure. 321 322 #### Mode: container 323 324 With the networking mode set to `container` a container will share the 325 network stack of another container. The other container's name must be 326 provided in the format of `--net container:<name|id>`. Note that `--add-host` 327 `--hostname` `--dns` `--dns-search` and `--mac-address` is invalid 328 in `container` netmode, and `--publish` `--publish-all` `--expose` are also 329 invalid in `container` netmode. 330 331 Example running a Redis container with Redis binding to `localhost` then 332 running the `redis-cli` command and connecting to the Redis server over the 333 `localhost` interface. 334 335 $ docker run -d --name redis example/redis --bind 127.0.0.1 336 $ # use the redis container's network stack to access localhost 337 $ docker run --rm -it --net container:redis example/redis-cli -h 127.0.0.1 338 339 ### Managing /etc/hosts 340 341 Your container will have lines in `/etc/hosts` which define the hostname of the 342 container itself as well as `localhost` and a few other common things. The 343 `--add-host` flag can be used to add additional lines to `/etc/hosts`. 344 345 $ docker run -it --add-host db-static:86.75.30.9 ubuntu cat /etc/hosts 346 172.17.0.22 09d03f76bf2c 347 fe00::0 ip6-localnet 348 ff00::0 ip6-mcastprefix 349 ff02::1 ip6-allnodes 350 ff02::2 ip6-allrouters 351 127.0.0.1 localhost 352 ::1 localhost ip6-localhost ip6-loopback 353 86.75.30.9 db-static 354 355 ## Restart policies (--restart) 356 357 Using the `--restart` flag on Docker run you can specify a restart policy for 358 how a container should or should not be restarted on exit. 359 360 When a restart policy is active on a container, it will be shown as either `Up` 361 or `Restarting` in [`docker ps`](/reference/commandline/cli/#ps). It can also be 362 useful to use [`docker events`](/reference/commandline/cli/#events) to see the 363 restart policy in effect. 364 365 Docker supports the following restart policies: 366 367 <table> 368 <thead> 369 <tr> 370 <th>Policy</th> 371 <th>Result</th> 372 </tr> 373 </thead> 374 <tbody> 375 <tr> 376 <td><strong>no</strong></td> 377 <td> 378 Do not automatically restart the container when it exits. This is the 379 default. 380 </td> 381 </tr> 382 <tr> 383 <td> 384 <span style="white-space: nowrap"> 385 <strong>on-failure</strong>[:max-retries] 386 </span> 387 </td> 388 <td> 389 Restart only if the container exits with a non-zero exit status. 390 Optionally, limit the number of restart retries the Docker 391 daemon attempts. 392 </td> 393 </tr> 394 <tr> 395 <td><strong>always</strong></td> 396 <td> 397 Always restart the container regardless of the exit status. 398 When you specify always, the Docker daemon will try to restart 399 the container indefinitely. 400 </td> 401 </tr> 402 </tbody> 403 </table> 404 405 An ever increasing delay (double the previous delay, starting at 100 406 milliseconds) is added before each restart to prevent flooding the server. 407 This means the daemon will wait for 100 ms, then 200 ms, 400, 800, 1600, 408 and so on until either the `on-failure` limit is hit, or when you `docker stop` 409 or `docker rm -f` the container. 410 411 If a container is successfully restarted (the container is started and runs 412 for at least 10 seconds), the delay is reset to its default value of 100 ms. 413 414 You can specify the maximum amount of times Docker will try to restart the 415 container when using the **on-failure** policy. The default is that Docker 416 will try forever to restart the container. The number of (attempted) restarts 417 for a container can be obtained via [`docker inspect`]( 418 /reference/commandline/cli/#inspect). For example, to get the number of restarts 419 for container "my-container"; 420 421 $ docker inspect -f "{{ .RestartCount }}" my-container 422 # 2 423 424 Or, to get the last time the container was (re)started; 425 426 $ docker inspect -f "{{ .State.StartedAt }}" my-container 427 # 2015-03-04T23:47:07.691840179Z 428 429 You cannot set any restart policy in combination with 430 ["clean up (--rm)"](#clean-up-rm). Setting both `--restart` and `--rm` 431 results in an error. 432 433 ###Examples 434 435 $ docker run --restart=always redis 436 437 This will run the `redis` container with a restart policy of **always** 438 so that if the container exits, Docker will restart it. 439 440 $ docker run --restart=on-failure:10 redis 441 442 This will run the `redis` container with a restart policy of **on-failure** 443 and a maximum restart count of 10. If the `redis` container exits with a 444 non-zero exit status more than 10 times in a row Docker will abort trying to 445 restart the container. Providing a maximum restart limit is only valid for the 446 **on-failure** policy. 447 448 ## Clean up (--rm) 449 450 By default a container's file system persists even after the container 451 exits. This makes debugging a lot easier (since you can inspect the 452 final state) and you retain all your data by default. But if you are 453 running short-term **foreground** processes, these container file 454 systems can really pile up. If instead you'd like Docker to 455 **automatically clean up the container and remove the file system when 456 the container exits**, you can add the `--rm` flag: 457 458 --rm=false: Automatically remove the container when it exits (incompatible with -d) 459 460 ## Security configuration 461 --security-opt="label:user:USER" : Set the label user for the container 462 --security-opt="label:role:ROLE" : Set the label role for the container 463 --security-opt="label:type:TYPE" : Set the label type for the container 464 --security-opt="label:level:LEVEL" : Set the label level for the container 465 --security-opt="label:disable" : Turn off label confinement for the container 466 --security-opt="apparmor:PROFILE" : Set the apparmor profile to be applied 467 to the container 468 469 You can override the default labeling scheme for each container by specifying 470 the `--security-opt` flag. For example, you can specify the MCS/MLS level, a 471 requirement for MLS systems. Specifying the level in the following command 472 allows you to share the same content between containers. 473 474 $ docker run --security-opt label:level:s0:c100,c200 -i -t fedora bash 475 476 An MLS example might be: 477 478 $ docker run --security-opt label:level:TopSecret -i -t rhel7 bash 479 480 To disable the security labeling for this container versus running with the 481 `--permissive` flag, use the following command: 482 483 $ docker run --security-opt label:disable -i -t fedora bash 484 485 If you want a tighter security policy on the processes within a container, 486 you can specify an alternate type for the container. You could run a container 487 that is only allowed to listen on Apache ports by executing the following 488 command: 489 490 $ docker run --security-opt label:type:svirt_apache_t -i -t centos bash 491 492 Note: 493 494 You would have to write policy defining a `svirt_apache_t` type. 495 496 ## Specifying custom cgroups 497 498 Using the `--cgroup-parent` flag, you can pass a specific cgroup to run a 499 container in. This allows you to create and manage cgroups on their own. You can 500 define custom resources for those cgroups and put containers under a common 501 parent group. 502 503 ## Runtime constraints on resources 504 505 The operator can also adjust the performance parameters of the 506 container: 507 508 -m, --memory="": Memory limit (format: <number><optional unit>, where unit = b, k, m or g) 509 -memory-swap="": Total memory limit (memory + swap, format: <number><optional unit>, where unit = b, k, m or g) 510 -c, --cpu-shares=0: CPU shares (relative weight) 511 --cpu-period=0: Limit the CPU CFS (Completely Fair Scheduler) period 512 --cpuset-cpus="": CPUs in which to allow execution (0-3, 0,1) 513 --cpuset-mems="": Memory nodes (MEMs) in which to allow execution (0-3, 0,1). Only effective on NUMA systems. 514 --cpu-quota=0: Limit the CPU CFS (Completely Fair Scheduler) quota 515 --blkio-weight=0: Block IO weight (relative weight) accepts a weight value between 10 and 1000. 516 --oom-kill-disable=true|false: Whether to disable OOM Killer for the container or not. 517 518 ### Memory constraints 519 520 We have four ways to set memory usage: 521 522 <table> 523 <thead> 524 <tr> 525 <th>Option</th> 526 <th>Result</th> 527 </tr> 528 </thead> 529 <tbody> 530 <tr> 531 <td class="no-wrap"> 532 <strong>memory=inf, memory-swap=inf</strong> (default) 533 </td> 534 <td> 535 There is no memory limit for the container. The container can use 536 as much memory as needed. 537 </td> 538 </tr> 539 <tr> 540 <td class="no-wrap"><strong>memory=L<inf, memory-swap=inf</strong></td> 541 <td> 542 (specify memory and set memory-swap as <code>-1</code>) The container is 543 not allowed to use more than L bytes of memory, but can use as much swap 544 as is needed (if the host supports swap memory). 545 </td> 546 </tr> 547 <tr> 548 <td class="no-wrap"><strong>memory=L<inf, memory-swap=2*L</strong></td> 549 <td> 550 (specify memory without memory-swap) The container is not allowed to 551 use more than L bytes of memory, swap *plus* memory usage is double 552 of that. 553 </td> 554 </tr> 555 <tr> 556 <td class="no-wrap"> 557 <strong>memory=L<inf, memory-swap=S<inf, L<=S</strong> 558 </td> 559 <td> 560 (specify both memory and memory-swap) The container is not allowed to 561 use more than L bytes of memory, swap *plus* memory usage is limited 562 by S. 563 </td> 564 </tr> 565 </tbody> 566 </table> 567 568 Examples: 569 570 $ docker run -ti ubuntu:14.04 /bin/bash 571 572 We set nothing about memory, this means the processes in the container can use 573 as much memory and swap memory as they need. 574 575 $ docker run -ti -m 300M --memory-swap -1 ubuntu:14.04 /bin/bash 576 577 We set memory limit and disabled swap memory limit, this means the processes in 578 the container can use 300M memory and as much swap memory as they need (if the 579 host supports swap memory). 580 581 $ docker run -ti -m 300M ubuntu:14.04 /bin/bash 582 583 We set memory limit only, this means the processes in the container can use 584 300M memory and 300M swap memory, by default, the total virtual memory size 585 (--memory-swap) will be set as double of memory, in this case, memory + swap 586 would be 2*300M, so processes can use 300M swap memory as well. 587 588 $ docker run -ti -m 300M --memory-swap 1G ubuntu:14.04 /bin/bash 589 590 We set both memory and swap memory, so the processes in the container can use 591 300M memory and 700M swap memory. 592 593 By default, Docker kills processes in a container if an out-of-memory (OOM) 594 error occurs. To change this behaviour, use the `--oom-kill-disable` option. 595 Only disable the OOM killer on containers where you have also set the 596 `-m/--memory` option. If the `-m` flag is not set, this can result in the host 597 running out of memory and require killing the host's system processes to free 598 memory. 599 600 Examples: 601 602 The following example limits the memory to 100M and disables the OOM killer for 603 this container: 604 605 $ docker run -ti -m 100M --oom-kill-disable ubuntu:14.04 /bin/bash 606 607 The following example, illustrates a dangerous way to use the flag: 608 609 $ docker run -ti --oom-kill-disable ubuntu:14.04 /bin/bash 610 611 The container has unlimited memory which can cause the host to run out memory 612 and require killing system processes to free memory. 613 614 ### CPU share constraint 615 616 By default, all containers get the same proportion of CPU cycles. This proportion 617 can be modified by changing the container's CPU share weighting relative 618 to the weighting of all other running containers. 619 620 To modify the proportion from the default of 1024, use the `-c` or `--cpu-shares` 621 flag to set the weighting to 2 or higher. 622 623 The proportion will only apply when CPU-intensive processes are running. 624 When tasks in one container are idle, other containers can use the 625 left-over CPU time. The actual amount of CPU time will vary depending on 626 the number of containers running on the system. 627 628 For example, consider three containers, one has a cpu-share of 1024 and 629 two others have a cpu-share setting of 512. When processes in all three 630 containers attempt to use 100% of CPU, the first container would receive 631 50% of the total CPU time. If you add a fourth container with a cpu-share 632 of 1024, the first container only gets 33% of the CPU. The remaining containers 633 receive 16.5%, 16.5% and 33% of the CPU. 634 635 On a multi-core system, the shares of CPU time are distributed over all CPU 636 cores. Even if a container is limited to less than 100% of CPU time, it can 637 use 100% of each individual CPU core. 638 639 For example, consider a system with more than three cores. If you start one 640 container `{C0}` with `-c=512` running one process, and another container 641 `{C1}` with `-c=1024` running two processes, this can result in the following 642 division of CPU shares: 643 644 PID container CPU CPU share 645 100 {C0} 0 100% of CPU0 646 101 {C1} 1 100% of CPU1 647 102 {C1} 2 100% of CPU2 648 649 ### CPU period constraint 650 651 The default CPU CFS (Completely Fair Scheduler) period is 100ms. We can use 652 `--cpu-period` to set the period of CPUs to limit the container's CPU usage. 653 And usually `--cpu-period` should work with `--cpu-quota`. 654 655 Examples: 656 657 $ docker run -ti --cpu-period=50000 --cpu-quota=25000 ubuntu:14.04 /bin/bash 658 659 If there is 1 CPU, this means the container can get 50% CPU worth of run-time every 50ms. 660 661 For more information, see the [CFS documentation on bandwidth limiting](https://www.kernel.org/doc/Documentation/scheduler/sched-bwc.txt). 662 663 ### Cpuset constraint 664 665 We can set cpus in which to allow execution for containers. 666 667 Examples: 668 669 $ docker run -ti --cpuset-cpus="1,3" ubuntu:14.04 /bin/bash 670 671 This means processes in container can be executed on cpu 1 and cpu 3. 672 673 $ docker run -ti --cpuset-cpus="0-2" ubuntu:14.04 /bin/bash 674 675 This means processes in container can be executed on cpu 0, cpu 1 and cpu 2. 676 677 We can set mems in which to allow execution for containers. Only effective 678 on NUMA systems. 679 680 Examples: 681 682 $ docker run -ti --cpuset-mems="1,3" ubuntu:14.04 /bin/bash 683 684 This example restricts the processes in the container to only use memory from 685 memory nodes 1 and 3. 686 687 $ docker run -ti --cpuset-mems="0-2" ubuntu:14.04 /bin/bash 688 689 This example restricts the processes in the container to only use memory from 690 memory nodes 0, 1 and 2. 691 692 ### CPU quota constraint 693 694 The `--cpu-quota` flag limits the container's CPU usage. The default 0 value 695 allows the container to take 100% of a CPU resource (1 CPU). The CFS (Completely Fair 696 Scheduler) handles resource allocation for executing processes and is default 697 Linux Scheduler used by the kernel. Set this value to 50000 to limit the container 698 to 50% of a CPU resource. For multiple CPUs, adjust the `--cpu-quota` as necessary. 699 For more information, see the [CFS documentation on bandwidth limiting](https://www.kernel.org/doc/Documentation/scheduler/sched-bwc.txt). 700 701 ### Block IO bandwidth (Blkio) constraint 702 703 By default, all containers get the same proportion of block IO bandwidth 704 (blkio). This proportion is 500. To modify this proportion, change the 705 container's blkio weight relative to the weighting of all other running 706 containers using the `--blkio-weight` flag. 707 708 The `--blkio-weight` flag can set the weighting to a value between 10 to 1000. 709 For example, the commands below create two containers with different blkio 710 weight: 711 712 $ docker run -ti --name c1 --blkio-weight 300 ubuntu:14.04 /bin/bash 713 $ docker run -ti --name c2 --blkio-weight 600 ubuntu:14.04 /bin/bash 714 715 If you do block IO in the two containers at the same time, by, for example: 716 717 $ time dd if=/mnt/zerofile of=test.out bs=1M count=1024 oflag=direct 718 719 You'll find that the proportion of time is the same as the proportion of blkio 720 weights of the two containers. 721 722 > **Note:** The blkio weight setting is only available for direct IO. Buffered IO 723 > is not currently supported. 724 725 ## Runtime privilege, Linux capabilities, and LXC configuration 726 727 --cap-add: Add Linux capabilities 728 --cap-drop: Drop Linux capabilities 729 --privileged=false: Give extended privileges to this container 730 --device=[]: Allows you to run devices inside the container without the --privileged flag. 731 --lxc-conf=[]: Add custom lxc options 732 733 By default, Docker containers are "unprivileged" and cannot, for 734 example, run a Docker daemon inside a Docker container. This is because 735 by default a container is not allowed to access any devices, but a 736 "privileged" container is given access to all devices (see [lxc-template.go]( 737 https://github.com/docker/docker/blob/master/daemon/execdriver/lxc/lxc_template.go) 738 and documentation on [cgroups devices]( 739 https://www.kernel.org/doc/Documentation/cgroups/devices.txt)). 740 741 When the operator executes `docker run --privileged`, Docker will enable 742 to access to all devices on the host as well as set some configuration 743 in AppArmor or SELinux to allow the container nearly all the same access to the 744 host as processes running outside containers on the host. Additional 745 information about running with `--privileged` is available on the 746 [Docker Blog](http://blog.docker.com/2013/09/docker-can-now-run-within-docker/). 747 748 If you want to limit access to a specific device or devices you can use 749 the `--device` flag. It allows you to specify one or more devices that 750 will be accessible within the container. 751 752 $ docker run --device=/dev/snd:/dev/snd ... 753 754 By default, the container will be able to `read`, `write`, and `mknod` these devices. 755 This can be overridden using a third `:rwm` set of options to each `--device` flag: 756 757 $ docker run --device=/dev/sda:/dev/xvdc --rm -it ubuntu fdisk /dev/xvdc 758 759 Command (m for help): q 760 $ docker run --device=/dev/sda:/dev/xvdc:r --rm -it ubuntu fdisk /dev/xvdc 761 You will not be able to write the partition table. 762 763 Command (m for help): q 764 765 $ docker run --device=/dev/sda:/dev/xvdc:w --rm -it ubuntu fdisk /dev/xvdc 766 crash.... 767 768 $ docker run --device=/dev/sda:/dev/xvdc:m --rm -it ubuntu fdisk /dev/xvdc 769 fdisk: unable to open /dev/xvdc: Operation not permitted 770 771 In addition to `--privileged`, the operator can have fine grain control over the 772 capabilities using `--cap-add` and `--cap-drop`. By default, Docker has a default 773 list of capabilities that are kept. The following table lists the Linux capability options which can be added or dropped. 774 775 | Capability Key | Capability Description | 776 | :----------------- | :---------------| :-------------------- | 777 | SETPCAP | Modify process capabilities. | 778 | SYS_MODULE| Load and unload kernel modules. | 779 | SYS_RAWIO | Perform I/O port operations (iopl(2) and ioperm(2)). | 780 | SYS_PACCT | Use acct(2), switch process accounting on or off. | 781 | SYS_ADMIN | Perform a range of system administration operations. | 782 | SYS_NICE | Raise process nice value (nice(2), setpriority(2)) and change the nice value for arbitrary processes. | 783 | SYS_RESOURCE | Override resource Limits. | 784 | SYS_TIME | Set system clock (settimeofday(2), stime(2), adjtimex(2)); set real-time (hardware) clock. | 785 | SYS_TTY_CONFIG | Use vhangup(2); employ various privileged ioctl(2) operations on virtual terminals. | 786 | MKNOD | Create special files using mknod(2). | 787 | AUDIT_WRITE | Write records to kernel auditing log. | 788 | AUDIT_CONTROL | Enable and disable kernel auditing; change auditing filter rules; retrieve auditing status and filtering rules. | 789 | MAC_OVERRIDE | Allow MAC configuration or state changes. Implemented for the Smack LSM. | 790 | MAC_ADMIN | Override Mandatory Access Control (MAC). Implemented for the Smack Linux Security Module (LSM). | 791 | NET_ADMIN | Perform various network-related operations. | 792 | SYSLOG | Perform privileged syslog(2) operations. | 793 | CHOWN | Make arbitrary changes to file UIDs and GIDs (see chown(2)). | 794 | NET_RAW | Use RAW and PACKET sockets. | 795 | DAC_OVERRIDE | Bypass file read, write, and execute permission checks. | 796 | FOWNER | Bypass permission checks on operations that normally require the file system UID of the process to match the UID of the file. | 797 | DAC_READ_SEARCH | Bypass file read permission checks and directory read and execute permission checks. | 798 | FSETID | Don't clear set-user-ID and set-group-ID permission bits when a file is modified. | 799 | KILL | Bypass permission checks for sending signals. | 800 | SETGID | Make arbitrary manipulations of process GIDs and supplementary GID list. | 801 | SETUID | Make arbitrary manipulations of process UIDs. | 802 | LINUX_IMMUTABLE | Set the FS_APPEND_FL and FS_IMMUTABLE_FL i-node flags. | 803 | NET_BIND_SERVICE | Bind a socket to internet domain privileged ports (port numbers less than 1024). | 804 | NET_BROADCAST | Make socket broadcasts, and listen to multicasts. | 805 | IPC_LOCK | Lock memory (mlock(2), mlockall(2), mmap(2), shmctl(2)). | 806 | IPC_OWNER | Bypass permission checks for operations on System V IPC objects. | 807 | SYS_CHROOT | Use chroot(2), change root directory. | 808 | SYS_PTRACE | Trace arbitrary processes using ptrace(2). | 809 | SYS_BOOT | Use reboot(2) and kexec_load(2), reboot and load a new kernel for later execution. | 810 | LEASE | Establish leases on arbitrary files (see fcntl(2)). | 811 | SETFCAP | Set file capabilities.| 812 | WAKE_ALARM | Trigger something that will wake up the system. | 813 | BLOCK_SUSPEND | Employ features that can block system suspend. | 814 815 Further reference information is available on the [capabilities(7) - Linux man page](http://linux.die.net/man/7/capabilities) 816 817 Both flags support the value `all`, so if the 818 operator wants to have all capabilities but `MKNOD` they could use: 819 820 $ docker run --cap-add=ALL --cap-drop=MKNOD ... 821 822 For interacting with the network stack, instead of using `--privileged` they 823 should use `--cap-add=NET_ADMIN` to modify the network interfaces. 824 825 $ docker run -t -i --rm ubuntu:14.04 ip link add dummy0 type dummy 826 RTNETLINK answers: Operation not permitted 827 $ docker run -t -i --rm --cap-add=NET_ADMIN ubuntu:14.04 ip link add dummy0 type dummy 828 829 To mount a FUSE based filesystem, you need to combine both `--cap-add` and 830 `--device`: 831 832 $ docker run --rm -it --cap-add SYS_ADMIN sshfs sshfs sven@10.10.10.20:/home/sven /mnt 833 fuse: failed to open /dev/fuse: Operation not permitted 834 $ docker run --rm -it --device /dev/fuse sshfs sshfs sven@10.10.10.20:/home/sven /mnt 835 fusermount: mount failed: Operation not permitted 836 $ docker run --rm -it --cap-add SYS_ADMIN --device /dev/fuse sshfs 837 # sshfs sven@10.10.10.20:/home/sven /mnt 838 The authenticity of host '10.10.10.20 (10.10.10.20)' can't be established. 839 ECDSA key fingerprint is 25:34:85:75:25:b0:17:46:05:19:04:93:b5:dd:5f:c6. 840 Are you sure you want to continue connecting (yes/no)? yes 841 sven@10.10.10.20's password: 842 root@30aa0cfaf1b5:/# ls -la /mnt/src/docker 843 total 1516 844 drwxrwxr-x 1 1000 1000 4096 Dec 4 06:08 . 845 drwxrwxr-x 1 1000 1000 4096 Dec 4 11:46 .. 846 -rw-rw-r-- 1 1000 1000 16 Oct 8 00:09 .dockerignore 847 -rwxrwxr-x 1 1000 1000 464 Oct 8 00:09 .drone.yml 848 drwxrwxr-x 1 1000 1000 4096 Dec 4 06:11 .git 849 -rw-rw-r-- 1 1000 1000 461 Dec 4 06:08 .gitignore 850 .... 851 852 853 If the Docker daemon was started using the `lxc` exec-driver 854 (`docker -d --exec-driver=lxc`) then the operator can also specify LXC options 855 using one or more `--lxc-conf` parameters. These can be new parameters or 856 override existing parameters from the [lxc-template.go]( 857 https://github.com/docker/docker/blob/master/daemon/execdriver/lxc/lxc_template.go). 858 Note that in the future, a given host's docker daemon may not use LXC, so this 859 is an implementation-specific configuration meant for operators already 860 familiar with using LXC directly. 861 862 > **Note:** 863 > If you use `--lxc-conf` to modify a container's configuration which is also 864 > managed by the Docker daemon, then the Docker daemon will not know about this 865 > modification, and you will need to manage any conflicts yourself. For example, 866 > you can use `--lxc-conf` to set a container's IP address, but this will not be 867 > reflected in the `/etc/hosts` file. 868 869 # Logging drivers (--log-driver) 870 871 The container can have a different logging driver than the Docker daemon. Use 872 the `--log-driver=VALUE` with the `docker run` command to configure the 873 container's logging driver. The following options are supported: 874 875 | `none` | Disables any logging for the container. `docker logs` won't be available with this driver. | 876 |-------------|-------------------------------------------------------------------------------------------------------------------------------| 877 | `json-file` | Default logging driver for Docker. Writes JSON messages to file. No logging options are supported for this driver. | 878 | `syslog` | Syslog logging driver for Docker. Writes log messages to syslog. | 879 | `journald` | Journald logging driver for Docker. Writes log messages to `journald`. | 880 | `gelf` | Graylog Extended Log Format (GELF) logging driver for Docker. Writes log messages to a GELF endpoint likeGraylog or Logstash. | 881 | `fluentd` | Fluentd logging driver for Docker. Writes log messages to `fluentd` (forward input). | 882 883 The `docker logs`command is available only for the `json-file` logging 884 driver. For detailed information on working with logging drivers, see 885 [Configure a logging driver](reference/logging/). 886 887 #### Logging driver: fluentd 888 889 Fluentd logging driver for Docker. Writes log messages to fluentd (forward input). `docker logs` 890 command is not available for this logging driver. 891 892 Some options are supported by specifying `--log-opt` as many as needed, like `--log-opt fluentd-address=localhost:24224 --log-opt fluentd-tag=docker.{{.Name}}`. 893 894 - `fluentd-address`: specify `host:port` to connect [localhost:24224] 895 - `fluentd-tag`: specify tag for fluentd message, which interpret some markup, ex `{{.ID}}`, `{{.FullID}}` or `{{.Name}}` [docker.{{.ID}}] 896 897 ## Overriding Dockerfile image defaults 898 899 When a developer builds an image from a [*Dockerfile*](/reference/builder) 900 or when she commits it, the developer can set a number of default parameters 901 that take effect when the image starts up as a container. 902 903 Four of the Dockerfile commands cannot be overridden at runtime: `FROM`, 904 `MAINTAINER`, `RUN`, and `ADD`. Everything else has a corresponding override 905 in `docker run`. We'll go through what the developer might have set in each 906 Dockerfile instruction and how the operator can override that setting. 907 908 - [CMD (Default Command or Options)](#cmd-default-command-or-options) 909 - [ENTRYPOINT (Default Command to Execute at Runtime)]( 910 #entrypoint-default-command-to-execute-at-runtime) 911 - [EXPOSE (Incoming Ports)](#expose-incoming-ports) 912 - [ENV (Environment Variables)](#env-environment-variables) 913 - [VOLUME (Shared Filesystems)](#volume-shared-filesystems) 914 - [USER](#user) 915 - [WORKDIR](#workdir) 916 917 ## CMD (default command or options) 918 919 Recall the optional `COMMAND` in the Docker 920 commandline: 921 922 $ docker run [OPTIONS] IMAGE[:TAG|@DIGEST] [COMMAND] [ARG...] 923 924 This command is optional because the person who created the `IMAGE` may 925 have already provided a default `COMMAND` using the Dockerfile `CMD` 926 instruction. As the operator (the person running a container from the 927 image), you can override that `CMD` instruction just by specifying a new 928 `COMMAND`. 929 930 If the image also specifies an `ENTRYPOINT` then the `CMD` or `COMMAND` 931 get appended as arguments to the `ENTRYPOINT`. 932 933 ## ENTRYPOINT (default command to execute at runtime) 934 935 --entrypoint="": Overwrite the default entrypoint set by the image 936 937 The `ENTRYPOINT` of an image is similar to a `COMMAND` because it 938 specifies what executable to run when the container starts, but it is 939 (purposely) more difficult to override. The `ENTRYPOINT` gives a 940 container its default nature or behavior, so that when you set an 941 `ENTRYPOINT` you can run the container *as if it were that binary*, 942 complete with default options, and you can pass in more options via the 943 `COMMAND`. But, sometimes an operator may want to run something else 944 inside the container, so you can override the default `ENTRYPOINT` at 945 runtime by using a string to specify the new `ENTRYPOINT`. Here is an 946 example of how to run a shell in a container that has been set up to 947 automatically run something else (like `/usr/bin/redis-server`): 948 949 $ docker run -i -t --entrypoint /bin/bash example/redis 950 951 or two examples of how to pass more parameters to that ENTRYPOINT: 952 953 $ docker run -i -t --entrypoint /bin/bash example/redis -c ls -l 954 $ docker run -i -t --entrypoint /usr/bin/redis-cli example/redis --help 955 956 ## EXPOSE (incoming ports) 957 958 The Dockerfile doesn't give much control over networking, only providing 959 the `EXPOSE` instruction to give a hint to the operator about what 960 incoming ports might provide services. The following options work with 961 or override the Dockerfile's exposed defaults: 962 963 --expose=[]: Expose a port or a range of ports from the container 964 without publishing it to your host 965 -P=false : Publish all exposed ports to the host interfaces 966 -p=[] : Publish a container᾿s port or a range of ports to the host 967 format: ip:hostPort:containerPort | ip::containerPort | hostPort:containerPort | containerPort 968 Both hostPort and containerPort can be specified as a range of ports. 969 When specifying ranges for both, the number of container ports in the range must match the number of host ports in the range. (e.g., `-p 1234-1236:1234-1236/tcp`) 970 (use 'docker port' to see the actual mapping) 971 --link="" : Add link to another container (<name or id>:alias or <name or id>) 972 973 As mentioned previously, `EXPOSE` (and `--expose`) makes ports available 974 **in** a container for incoming connections. The port number on the 975 inside of the container (where the service listens) does not need to be 976 the same number as the port exposed on the outside of the container 977 (where clients connect), so inside the container you might have an HTTP 978 service listening on port 80 (and so you `EXPOSE 80` in the Dockerfile), 979 but outside the container the port might be 42800. 980 981 To help a new client container reach the server container's internal 982 port operator `--expose`'d by the operator or `EXPOSE`'d by the 983 developer, the operator has three choices: start the server container 984 with `-P` or `-p,` or start the client container with `--link`. 985 986 If the operator uses `-P` or `-p` then Docker will make the exposed port 987 accessible on the host and the ports will be available to any client that can 988 reach the host. When using `-P`, Docker will bind the exposed port to a random 989 port on the host within an *ephemeral port range* defined by 990 `/proc/sys/net/ipv4/ip_local_port_range`. To find the mapping between the host 991 ports and the exposed ports, use `docker port`. 992 993 If the operator uses `--link` when starting the new client container, 994 then the client container can access the exposed port via a private 995 networking interface. Docker will set some environment variables in the 996 client container to help indicate which interface and port to use. 997 998 ## ENV (environment variables) 999 1000 When a new container is created, Docker will set the following environment 1001 variables automatically: 1002 1003 <table> 1004 <tr> 1005 <th>Variable</th> 1006 <th>Value</th> 1007 </tr> 1008 <tr> 1009 <td><code>HOME</code></td> 1010 <td> 1011 Set based on the value of <code>USER</code> 1012 </td> 1013 </tr> 1014 <tr> 1015 <td><code>HOSTNAME</code></td> 1016 <td> 1017 The hostname associated with the container 1018 </td> 1019 </tr> 1020 <tr> 1021 <td><code>PATH</code></td> 1022 <td> 1023 Includes popular directories, such as :<br> 1024 <code>/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin</code> 1025 </td> 1026 <tr> 1027 <td><code>TERM</code></td> 1028 <td><code>xterm</code> if the container is allocated a pseudo-TTY</td> 1029 </tr> 1030 </table> 1031 1032 The container may also include environment variables defined 1033 as a result of the container being linked with another container. See 1034 the [*Container Links*](/userguide/dockerlinks/#container-linking) 1035 section for more details. 1036 1037 Additionally, the operator can **set any environment variable** in the 1038 container by using one or more `-e` flags, even overriding those mentioned 1039 above, or already defined by the developer with a Dockerfile `ENV`: 1040 1041 $ docker run -e "deep=purple" --rm ubuntu /bin/bash -c export 1042 declare -x HOME="/" 1043 declare -x HOSTNAME="85bc26a0e200" 1044 declare -x OLDPWD 1045 declare -x PATH="/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin" 1046 declare -x PWD="/" 1047 declare -x SHLVL="1" 1048 declare -x container="lxc" 1049 declare -x deep="purple" 1050 1051 Similarly the operator can set the **hostname** with `-h`. 1052 1053 `--link <name or id>:alias` also sets environment variables, using the *alias* string to 1054 define environment variables within the container that give the IP and PORT 1055 information for connecting to the service container. Let's imagine we have a 1056 container running Redis: 1057 1058 # Start the service container, named redis-name 1059 $ docker run -d --name redis-name dockerfiles/redis 1060 4241164edf6f5aca5b0e9e4c9eccd899b0b8080c64c0cd26efe02166c73208f3 1061 1062 # The redis-name container exposed port 6379 1063 $ docker ps 1064 CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES 1065 4241164edf6f $ dockerfiles/redis:latest /redis-stable/src/re 5 seconds ago Up 4 seconds 6379/tcp redis-name 1066 1067 # Note that there are no public ports exposed since we didn᾿t use -p or -P 1068 $ docker port 4241164edf6f 6379 1069 2014/01/25 00:55:38 Error: No public port '6379' published for 4241164edf6f 1070 1071 Yet we can get information about the Redis container's exposed ports 1072 with `--link`. Choose an alias that will form a 1073 valid environment variable! 1074 1075 $ docker run --rm --link redis-name:redis_alias --entrypoint /bin/bash dockerfiles/redis -c export 1076 declare -x HOME="/" 1077 declare -x HOSTNAME="acda7f7b1cdc" 1078 declare -x OLDPWD 1079 declare -x PATH="/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin" 1080 declare -x PWD="/" 1081 declare -x REDIS_ALIAS_NAME="/distracted_wright/redis" 1082 declare -x REDIS_ALIAS_PORT="tcp://172.17.0.32:6379" 1083 declare -x REDIS_ALIAS_PORT_6379_TCP="tcp://172.17.0.32:6379" 1084 declare -x REDIS_ALIAS_PORT_6379_TCP_ADDR="172.17.0.32" 1085 declare -x REDIS_ALIAS_PORT_6379_TCP_PORT="6379" 1086 declare -x REDIS_ALIAS_PORT_6379_TCP_PROTO="tcp" 1087 declare -x SHLVL="1" 1088 declare -x container="lxc" 1089 1090 And we can use that information to connect from another container as a client: 1091 1092 $ docker run -i -t --rm --link redis-name:redis_alias --entrypoint /bin/bash dockerfiles/redis -c '/redis-stable/src/redis-cli -h $REDIS_ALIAS_PORT_6379_TCP_ADDR -p $REDIS_ALIAS_PORT_6379_TCP_PORT' 1093 172.17.0.32:6379> 1094 1095 Docker will also map the private IP address to the alias of a linked 1096 container by inserting an entry into `/etc/hosts`. You can use this 1097 mechanism to communicate with a linked container by its alias: 1098 1099 $ docker run -d --name servicename busybox sleep 30 1100 $ docker run -i -t --link servicename:servicealias busybox ping -c 1 servicealias 1101 1102 If you restart the source container (`servicename` in this case), the recipient 1103 container's `/etc/hosts` entry will be automatically updated. 1104 1105 > **Note**: 1106 > Unlike host entries in the `/etc/hosts` file, IP addresses stored in the 1107 > environment variables are not automatically updated if the source container is 1108 > restarted. We recommend using the host entries in `/etc/hosts` to resolve the 1109 > IP address of linked containers. 1110 1111 ## VOLUME (shared filesystems) 1112 1113 -v=[]: Create a bind mount with: [host-dir:]container-dir[:rw|ro]. 1114 If 'host-dir' is missing, then docker creates a new volume. 1115 If neither 'rw' or 'ro' is specified then the volume is mounted 1116 in read-write mode. 1117 --volumes-from="": Mount all volumes from the given container(s) 1118 1119 The volumes commands are complex enough to have their own documentation 1120 in section [*Managing data in 1121 containers*](/userguide/dockervolumes). A developer can define 1122 one or more `VOLUME`'s associated with an image, but only the operator 1123 can give access from one container to another (or from a container to a 1124 volume mounted on the host). 1125 1126 ## USER 1127 1128 The default user within a container is `root` (id = 0), but if the 1129 developer created additional users, those are accessible too. The 1130 developer can set a default user to run the first process with the 1131 Dockerfile `USER` instruction, but the operator can override it: 1132 1133 -u="": Username or UID 1134 1135 > **Note:** if you pass numeric uid, it must be in range 0-2147483647. 1136 1137 ## WORKDIR 1138 1139 The default working directory for running binaries within a container is the 1140 root directory (`/`), but the developer can set a different default with the 1141 Dockerfile `WORKDIR` command. The operator can override this with: 1142 1143 -w="": Working directory inside the container