| ... | ... |
@@ -93,8 +93,8 @@ too. |
| 93 | 93 |
**Option 5** creates a custom network of APT proxy server and Debian-based containers: |
| 94 | 94 |
|
| 95 | 95 |
$ docker network create mynetwork |
| 96 |
- $ docker run -d -p 3142:3142 --net=mynetwork --name test_apt_cacher_ng eg_apt_cacher_ng |
|
| 97 |
- $ docker run --rm -it --net=mynetwork -e http_proxy=http://test_apt_cacher_ng:3142/ debian bash |
|
| 96 |
+ $ docker run -d -p 3142:3142 --network=mynetwork --name test_apt_cacher_ng eg_apt_cacher_ng |
|
| 97 |
+ $ docker run --rm -it --network=mynetwork -e http_proxy=http://test_apt_cacher_ng:3142/ debian bash |
|
| 98 | 98 |
|
| 99 | 99 |
Apt-cacher-ng has some tools that allow you to manage the repository, |
| 100 | 100 |
and they can be used by leveraging the `VOLUME` |
| ... | ... |
@@ -46,7 +46,7 @@ Some network driver plugins are listed in [plugins](plugins.md) |
| 46 | 46 |
The `mynet` network is now owned by `weave`, so subsequent commands |
| 47 | 47 |
referring to that network will be sent to the plugin, |
| 48 | 48 |
|
| 49 |
- $ docker run --net=mynet busybox top |
|
| 49 |
+ $ docker run --network=mynet busybox top |
|
| 50 | 50 |
|
| 51 | 51 |
|
| 52 | 52 |
## Write a network plugin |
| ... | ... |
@@ -72,13 +72,13 @@ Options: |
| 72 | 72 |
--memory-swap string Swap limit equal to memory plus swap: '-1' to enable unlimited swap |
| 73 | 73 |
--memory-swappiness int Tune container memory swappiness (0 to 100) (default -1) |
| 74 | 74 |
--name string Assign a name to the container |
| 75 |
- --net string Connect a container to a network (default "default") |
|
| 75 |
+ --network-alias value Add network-scoped alias for the container (default []) |
|
| 76 |
+ --network string Connect a container to a network (default "default") |
|
| 76 | 77 |
'bridge': create a network stack on the default Docker bridge |
| 77 | 78 |
'none': no networking |
| 78 | 79 |
'container:<name|id>': reuse another container's network stack |
| 79 | 80 |
'host': use the Docker host network stack |
| 80 | 81 |
'<network-name>|<network-id>': connect to a user-defined network |
| 81 |
- --net-alias value Add network-scoped alias for the container (default []) |
|
| 82 | 82 |
--no-healthcheck Disable any container-specified HEALTHCHECK |
| 83 | 83 |
--oom-kill-disable Disable OOM Killer |
| 84 | 84 |
--oom-score-adj int Tune host's OOM preferences (-1000 to 1000) |
| ... | ... |
@@ -921,7 +921,7 @@ This option will completely disable user namespace mapping for the container's u |
| 921 | 921 |
The following standard Docker features are currently incompatible when |
| 922 | 922 |
running a Docker daemon with user namespaces enabled: |
| 923 | 923 |
|
| 924 |
- - sharing PID or NET namespaces with the host (`--pid=host` or `--net=host`) |
|
| 924 |
+ - sharing PID or NET namespaces with the host (`--pid=host` or `--network=host`) |
|
| 925 | 925 |
- A `--read-only` container filesystem (this is a Linux kernel restriction against remounting with modified flags of a currently mounted filesystem when inside a user namespace) |
| 926 | 926 |
- external (volume or graph) drivers which are unaware/incapable of using daemon user mappings |
| 927 | 927 |
- Using `--privileged` mode flag on `docker run` (unless also specifying `--userns=host`) |
| ... | ... |
@@ -32,10 +32,10 @@ the same network. |
| 32 | 32 |
$ docker network connect multi-host-network container1 |
| 33 | 33 |
``` |
| 34 | 34 |
|
| 35 |
-You can also use the `docker run --net=<network-name>` option to start a container and immediately connect it to a network. |
|
| 35 |
+You can also use the `docker run --network=<network-name>` option to start a container and immediately connect it to a network. |
|
| 36 | 36 |
|
| 37 | 37 |
```bash |
| 38 |
-$ docker run -itd --net=multi-host-network busybox |
|
| 38 |
+$ docker run -itd --network=multi-host-network busybox |
|
| 39 | 39 |
``` |
| 40 | 40 |
|
| 41 | 41 |
You can specify the IP address you want to be assigned to the container's interface. |
| ... | ... |
@@ -82,11 +82,11 @@ name conflicts. |
| 82 | 82 |
|
| 83 | 83 |
## Connect containers |
| 84 | 84 |
|
| 85 |
-When you start a container, use the `--net` flag to connect it to a network. |
|
| 85 |
+When you start a container, use the `--network` flag to connect it to a network. |
|
| 86 | 86 |
This example adds the `busybox` container to the `mynet` network: |
| 87 | 87 |
|
| 88 | 88 |
```bash |
| 89 |
-$ docker run -itd --net=mynet busybox |
|
| 89 |
+$ docker run -itd --network=mynet busybox |
|
| 90 | 90 |
``` |
| 91 | 91 |
|
| 92 | 92 |
If you want to add a container to a network after the container is already |
| ... | ... |
@@ -78,13 +78,13 @@ Options: |
| 78 | 78 |
--memory-swap string Swap limit equal to memory plus swap: '-1' to enable unlimited swap |
| 79 | 79 |
--memory-swappiness int Tune container memory swappiness (0 to 100) (default -1). |
| 80 | 80 |
--name string Assign a name to the container |
| 81 |
- --net string Connect a container to a network (default "default") |
|
| 81 |
+ --network-alias value Add network-scoped alias for the container (default []) |
|
| 82 |
+ --network string Connect a container to a network |
|
| 82 | 83 |
'bridge': create a network stack on the default Docker bridge |
| 83 | 84 |
'none': no networking |
| 84 | 85 |
'container:<name|id>': reuse another container's network stack |
| 85 | 86 |
'host': use the Docker host network stack |
| 86 | 87 |
'<network-name>|<network-id>': connect to a user-defined network |
| 87 |
- --net-alias value Add network-scoped alias for the container (default []) |
|
| 88 | 88 |
--no-healthcheck Disable any container-specified HEALTHCHECK |
| 89 | 89 |
--oom-kill-disable Disable OOM Killer |
| 90 | 90 |
--oom-score-adj int Tune host's OOM preferences (-1000 to 1000) |
| ... | ... |
@@ -360,20 +360,20 @@ For additional information on working with labels, see [*Labels - custom |
| 360 | 360 |
metadata in Docker*](../../userguide/labels-custom-metadata.md) in the Docker User |
| 361 | 361 |
Guide. |
| 362 | 362 |
|
| 363 |
-### Connect a container to a network (--net) |
|
| 363 |
+### Connect a container to a network (--network) |
|
| 364 | 364 |
|
| 365 |
-When you start a container use the `--net` flag to connect it to a network. |
|
| 365 |
+When you start a container use the `--network` flag to connect it to a network. |
|
| 366 | 366 |
This adds the `busybox` container to the `my-net` network. |
| 367 | 367 |
|
| 368 | 368 |
```bash |
| 369 |
-$ docker run -itd --net=my-net busybox |
|
| 369 |
+$ docker run -itd --network=my-net busybox |
|
| 370 | 370 |
``` |
| 371 | 371 |
|
| 372 | 372 |
You can also choose the IP addresses for the container with `--ip` and `--ip6` |
| 373 | 373 |
flags when you start the container on a user-defined network. |
| 374 | 374 |
|
| 375 | 375 |
```bash |
| 376 |
-$ docker run -itd --net=my-net --ip=10.10.9.75 busybox |
|
| 376 |
+$ docker run -itd --network=my-net --ip=10.10.9.75 busybox |
|
| 377 | 377 |
``` |
| 378 | 378 |
|
| 379 | 379 |
If you want to add a running container to a network use the `docker network connect` subcommand. |
| ... | ... |
@@ -673,4 +673,4 @@ network namespace, run this command: |
| 673 | 673 |
`Network Namespace`: |
| 674 | 674 |
Sysctls beginning with net.* |
| 675 | 675 |
|
| 676 |
- If you use the `--net=host` option using these sysctls will not be allowed. |
|
| 676 |
+ If you use the `--network=host` option using these sysctls will not be allowed. |
| ... | ... |
@@ -259,7 +259,7 @@ $ strace -p 1 |
| 259 | 259 |
|
| 260 | 260 |
The UTS namespace is for setting the hostname and the domain that is visible |
| 261 | 261 |
to running processes in that namespace. By default, all containers, including |
| 262 |
-those with `--net=host`, have their own UTS namespace. The `host` setting will |
|
| 262 |
+those with `--network=host`, have their own UTS namespace. The `host` setting will |
|
| 263 | 263 |
result in the container using the same UTS namespace as the host. Note that |
| 264 | 264 |
`--hostname` is invalid in `host` UTS mode. |
| 265 | 265 |
|
| ... | ... |
@@ -289,13 +289,13 @@ of the containers. |
| 289 | 289 |
## Network settings |
| 290 | 290 |
|
| 291 | 291 |
--dns=[] : Set custom dns servers for the container |
| 292 |
- --net="bridge" : Connect a container to a network |
|
| 292 |
+ --network="bridge" : Connect a container to a network |
|
| 293 | 293 |
'bridge': create a network stack on the default Docker bridge |
| 294 | 294 |
'none': no networking |
| 295 | 295 |
'container:<name|id>': reuse another container's network stack |
| 296 | 296 |
'host': use the Docker host network stack |
| 297 | 297 |
'<network-name>|<network-id>': connect to a user-defined network |
| 298 |
- --net-alias=[] : Add network-scoped alias for the container |
|
| 298 |
+ --network-alias=[] : Add network-scoped alias for the container |
|
| 299 | 299 |
--add-host="" : Add a line to /etc/hosts (host:IP) |
| 300 | 300 |
--mac-address="" : Sets the container's Ethernet device's MAC address |
| 301 | 301 |
--ip="" : Sets the container's Ethernet device's IPv4 address |
| ... | ... |
@@ -304,7 +304,7 @@ of the containers. |
| 304 | 304 |
|
| 305 | 305 |
By default, all containers have networking enabled and they can make any |
| 306 | 306 |
outgoing connections. The operator can completely disable networking |
| 307 |
-with `docker run --net none` which disables all incoming and outgoing |
|
| 307 |
+with `docker run --network none` which disables all incoming and outgoing |
|
| 308 | 308 |
networking. In cases like this, you would perform I/O through files or |
| 309 | 309 |
`STDIN` and `STDOUT` only. |
| 310 | 310 |
|
| ... | ... |
@@ -404,14 +404,14 @@ docker daemon. It is recommended to run containers in this mode when their |
| 404 | 404 |
networking performance is critical, for example, a production Load Balancer |
| 405 | 405 |
or a High Performance Web Server. |
| 406 | 406 |
|
| 407 |
-> **Note**: `--net="host"` gives the container full access to local system |
|
| 407 |
+> **Note**: `--network="host"` gives the container full access to local system |
|
| 408 | 408 |
> services such as D-bus and is therefore considered insecure. |
| 409 | 409 |
|
| 410 | 410 |
#### Network: container |
| 411 | 411 |
|
| 412 | 412 |
With the network set to `container` a container will share the |
| 413 | 413 |
network stack of another container. The other container's name must be |
| 414 |
-provided in the format of `--net container:<name|id>`. Note that `--add-host` |
|
| 414 |
+provided in the format of `--network container:<name|id>`. Note that `--add-host` |
|
| 415 | 415 |
`--hostname` `--dns` `--dns-search` `--dns-opt` and `--mac-address` are |
| 416 | 416 |
invalid in `container` netmode, and `--publish` `--publish-all` `--expose` are |
| 417 | 417 |
also invalid in `container` netmode. |
| ... | ... |
@@ -422,7 +422,7 @@ running the `redis-cli` command and connecting to the Redis server over the |
| 422 | 422 |
|
| 423 | 423 |
$ docker run -d --name redis example/redis --bind 127.0.0.1 |
| 424 | 424 |
$ # use the redis container's network stack to access localhost |
| 425 |
- $ docker run --rm -it --net container:redis example/redis-cli -h 127.0.0.1 |
|
| 425 |
+ $ docker run --rm -it --network container:redis example/redis-cli -h 127.0.0.1 |
|
| 426 | 426 |
|
| 427 | 427 |
#### User-defined network |
| 428 | 428 |
|
| ... | ... |
@@ -440,7 +440,7 @@ driver and running a container in the created network |
| 440 | 440 |
|
| 441 | 441 |
``` |
| 442 | 442 |
$ docker network create -d bridge my-net |
| 443 |
-$ docker run --net=my-net -itd --name=container3 busybox |
|
| 443 |
+$ docker run --network=my-net -itd --name=container3 busybox |
|
| 444 | 444 |
``` |
| 445 | 445 |
|
| 446 | 446 |
### Managing /etc/hosts |
| ... | ... |
@@ -198,9 +198,9 @@ To build web applications that act in concert but do so securely, create a |
| 198 | 198 |
network. Networks, by definition, provide complete isolation for containers. You |
| 199 | 199 |
can add containers to a network when you first run a container. |
| 200 | 200 |
|
| 201 |
-Launch a container running a PostgreSQL database and pass it the `--net=my-bridge-network` flag to connect it to your new network: |
|
| 201 |
+Launch a container running a PostgreSQL database and pass it the `--network=my-bridge-network` flag to connect it to your new network: |
|
| 202 | 202 |
|
| 203 |
- $ docker run -d --net=my-bridge-network --name db training/postgres |
|
| 203 |
+ $ docker run -d --network=my-bridge-network --name db training/postgres |
|
| 204 | 204 |
|
| 205 | 205 |
If you inspect your `my-bridge-network` you'll see it has a container attached. |
| 206 | 206 |
You can also inspect your container to see where it is connected: |
| ... | ... |
@@ -48,13 +48,13 @@ Various container options that affect container domain name services. |
| 48 | 48 |
<tr> |
| 49 | 49 |
<td> |
| 50 | 50 |
<p> |
| 51 |
- <code>--net-alias=ALIAS</code> |
|
| 51 |
+ <code>--network-alias=ALIAS</code> |
|
| 52 | 52 |
</p> |
| 53 | 53 |
</td> |
| 54 | 54 |
<td> |
| 55 | 55 |
<p> |
| 56 | 56 |
In addition to <code>--name</code> as described above, a container is discovered by one or more |
| 57 |
- of its configured <code>--net-alias</code> (or <code>--alias</code> in <code>docker network connect</code> command) |
|
| 57 |
+ of its configured <code>--network-alias</code> (or <code>--alias</code> in <code>docker network connect</code> command) |
|
| 58 | 58 |
within the user-defined network. The embedded DNS server maintains the mapping between |
| 59 | 59 |
all of the container aliases and its IP address on a specific user-defined network. |
| 60 | 60 |
A container can have different aliases in different networks by using the <code>--alias</code> |
| ... | ... |
@@ -42,7 +42,7 @@ or to turn it on manually: |
| 42 | 42 |
``` |
| 43 | 43 |
|
| 44 | 44 |
> **Note**: this setting does not affect containers that use the host |
| 45 |
-> network stack (`--net=host`). |
|
| 45 |
+> network stack (`--network=host`). |
|
| 46 | 46 |
|
| 47 | 47 |
Many using Docker will want `ip_forward` to be on, to at least make |
| 48 | 48 |
communication _possible_ between containers and the wider world. May also be |
| ... | ... |
@@ -37,12 +37,12 @@ cf03ee007fb4 host host |
| 37 | 37 |
``` |
| 38 | 38 |
|
| 39 | 39 |
Historically, these three networks are part of Docker's implementation. When |
| 40 |
-you run a container you can use the `--net` flag to specify which network you |
|
| 40 |
+you run a container you can use the `--network` flag to specify which network you |
|
| 41 | 41 |
want to run a container on. These three networks are still available to you. |
| 42 | 42 |
|
| 43 | 43 |
The `bridge` network represents the `docker0` network present in all Docker |
| 44 | 44 |
installations. Unless you specify otherwise with the `docker run |
| 45 |
+--network=<NETWORK>` option, the Docker daemon connects containers to this network |
|
| 45 | 46 |
by default. You can see this bridge as part of a host's network stack by using |
| 46 | 47 |
the `ifconfig` command on the host. |
| 47 | 48 |
|
| ... | ... |
@@ -352,10 +352,10 @@ c5ee82f76de3 isolated_nw bridge |
| 352 | 352 |
|
| 353 | 353 |
``` |
| 354 | 354 |
|
| 355 |
-After you create the network, you can launch containers on it using the `docker run --net=<NETWORK>` option. |
|
| 355 |
+After you create the network, you can launch containers on it using the `docker run --network=<NETWORK>` option. |
|
| 356 | 356 |
|
| 357 | 357 |
``` |
| 358 |
-$ docker run --net=isolated_nw -itd --name=container3 busybox |
|
| 358 |
+$ docker run --network=isolated_nw -itd --name=container3 busybox |
|
| 359 | 359 |
|
| 360 | 360 |
8c1a0a5be480921d669a073393ade66a3fc49933f08bcc5515b37b8144f6d47c |
| 361 | 361 |
|
| ... | ... |
@@ -473,7 +473,7 @@ provides complete isolation for the containers. |
| 473 | 473 |
|
| 474 | 474 |
Then, on each host, launch containers making sure to specify the network name. |
| 475 | 475 |
|
| 476 |
- $ docker run -itd --net=my-multi-host-network busybox |
|
| 476 |
+ $ docker run -itd --network=my-multi-host-network busybox |
|
| 477 | 477 |
|
| 478 | 478 |
Once connected, each container has access to all the containers in the network |
| 479 | 479 |
regardless of which Docker host the container was launched on. |
| ... | ... |
@@ -223,11 +223,11 @@ Once your network is created, you can start a container on any of the hosts and |
| 223 | 223 |
|
| 224 | 224 |
2. Start an Nginx web server on the `mhs-demo0` instance. |
| 225 | 225 |
|
| 226 |
- $ docker run -itd --name=web --net=my-net --env="constraint:node==mhs-demo0" nginx |
|
| 226 |
+ $ docker run -itd --name=web --network=my-net --env="constraint:node==mhs-demo0" nginx |
|
| 227 | 227 |
|
| 228 | 228 |
4. Run a BusyBox instance on the `mhs-demo1` instance and get the contents of the Nginx server's home page. |
| 229 | 229 |
|
| 230 |
- $ docker run -it --rm --net=my-net --env="constraint:node==mhs-demo1" busybox wget -O- http://web |
|
| 230 |
+ $ docker run -it --rm --network=my-net --env="constraint:node==mhs-demo1" busybox wget -O- http://web |
|
| 231 | 231 |
|
| 232 | 232 |
Unable to find image 'busybox:latest' locally |
| 233 | 233 |
latest: Pulling from library/busybox |
| ... | ... |
@@ -164,7 +164,7 @@ $ docker network inspect my-network |
| 164 | 164 |
} |
| 165 | 165 |
] |
| 166 | 166 |
|
| 167 |
-$ docker run -d -P --name redis --net my-network redis |
|
| 167 |
+$ docker run -d -P --name redis --network my-network redis |
|
| 168 | 168 |
|
| 169 | 169 |
bafb0c808c53104b2c90346f284bda33a69beadcab4fc83ab8f2c5a4410cd129 |
| 170 | 170 |
|
| ... | ... |
@@ -244,10 +244,10 @@ $ docker network inspect isolated_nw |
| 244 | 244 |
You can see that the Engine automatically assigns an IP address to `container2`. |
| 245 | 245 |
Given we specified a `--subnet` when creating the network, Engine picked |
| 246 | 246 |
an address from that same subnet. Now, start a third container and connect it to |
| 247 |
-the network on launch using the `docker run` command's `--net` option: |
|
| 247 |
+the network on launch using the `docker run` command's `--network` option: |
|
| 248 | 248 |
|
| 249 | 249 |
```bash |
| 250 |
-$ docker run --net=isolated_nw --ip=172.25.3.3 -itd --name=container3 busybox |
|
| 250 |
+$ docker run --network=isolated_nw --ip=172.25.3.3 -itd --name=container3 busybox |
|
| 251 | 251 |
|
| 252 | 252 |
467a7863c3f0277ef8e661b38427737f28099b61fa55622d6c30fb288d88c551 |
| 253 | 253 |
``` |
| ... | ... |
@@ -450,7 +450,7 @@ Continuing with the above example, create another container `container4` in |
| 450 | 450 |
for other containers in the same network. |
| 451 | 451 |
|
| 452 | 452 |
```bash |
| 453 |
-$ docker run --net=isolated_nw -itd --name=container4 --link container5:c5 busybox |
|
| 453 |
+$ docker run --network=isolated_nw -itd --name=container4 --link container5:c5 busybox |
|
| 454 | 454 |
|
| 455 | 455 |
01b5df970834b77a9eadbaff39051f237957bd35c4c56f11193e0594cfd5117c |
| 456 | 456 |
``` |
| ... | ... |
@@ -471,7 +471,7 @@ Now let us launch another container named `container5` linking `container4` to |
| 471 | 471 |
c4. |
| 472 | 472 |
|
| 473 | 473 |
```bash |
| 474 |
-$ docker run --net=isolated_nw -itd --name=container5 --link container4:c4 busybox |
|
| 474 |
+$ docker run --network=isolated_nw -itd --name=container5 --link container4:c4 busybox |
|
| 475 | 475 |
|
| 476 | 476 |
72eccf2208336f31e9e33ba327734125af00d1e1d2657878e2ee8154fbb23c7a |
| 477 | 477 |
``` |
| ... | ... |
@@ -629,7 +629,7 @@ Continuing with the above example, create another container in `isolated_nw` |
| 629 | 629 |
with a network alias. |
| 630 | 630 |
|
| 631 | 631 |
```bash |
| 632 |
-$ docker run --net=isolated_nw -itd --name=container6 --net-alias app busybox |
|
| 632 |
+$ docker run --network=isolated_nw -itd --name=container6 --network-alias app busybox |
|
| 633 | 633 |
|
| 634 | 634 |
8ebe6767c1e0361f27433090060b33200aac054a68476c3be87ef4005eb1df17 |
| 635 | 635 |
``` |
| ... | ... |
@@ -702,7 +702,7 @@ network-scoped alias within the same network. For example, let's launch |
| 702 | 702 |
`container7` in `isolated_nw` with the same alias as `container6` |
| 703 | 703 |
|
| 704 | 704 |
```bash |
| 705 |
-$ docker run --net=isolated_nw -itd --name=container7 --net-alias app busybox |
|
| 705 |
+$ docker run --network=isolated_nw -itd --name=container7 --network-alias app busybox |
|
| 706 | 706 |
|
| 707 | 707 |
3138c678c123b8799f4c7cc6a0cecc595acbdfa8bf81f621834103cd4f504554 |
| 708 | 708 |
``` |
| ... | ... |
@@ -859,7 +859,7 @@ endpoint from the network. Once the endpoint is cleaned up, the container can |
| 859 | 859 |
be connected to the network. |
| 860 | 860 |
|
| 861 | 861 |
```bash |
| 862 |
-$ docker run -d --name redis_db --net multihost redis |
|
| 862 |
+$ docker run -d --name redis_db --network multihost redis |
|
| 863 | 863 |
|
| 864 | 864 |
ERROR: Cannot start container bc0b19c089978f7845633027aa3435624ca3d12dd4f4f764b61eac4c0610f32e: container already connected to network multihost |
| 865 | 865 |
|
| ... | ... |
@@ -867,7 +867,7 @@ $ docker rm -f redis_db |
| 867 | 867 |
|
| 868 | 868 |
$ docker network disconnect -f multihost redis_db |
| 869 | 869 |
|
| 870 |
-$ docker run -d --name redis_db --net multihost redis |
|
| 870 |
+$ docker run -d --name redis_db --network multihost redis |
|
| 871 | 871 |
|
| 872 | 872 |
7d986da974aeea5e9f7aca7e510bdb216d58682faa83a9040c2f2adc0544795a |
| 873 | 873 |
``` |
| ... | ... |
@@ -1660,3 +1660,15 @@ func (s *DockerDaemonSuite) TestDaemonRestartRestoreBridgeNetwork(t *check.C) {
|
| 1660 | 1660 |
t.Fatal(err) |
| 1661 | 1661 |
} |
| 1662 | 1662 |
} |
| 1663 |
+ |
|
| 1664 |
+func (s *DockerNetworkSuite) TestDockerNetworkFlagAlias(c *check.C) {
|
|
| 1665 |
+ dockerCmd(c, "network", "create", "user") |
|
| 1666 |
+ output, status := dockerCmd(c, "run", "--rm", "--network=user", "--network-alias=foo", "busybox", "true") |
|
| 1667 |
+ c.Assert(status, checker.Equals, 0, check.Commentf("unexpected status code %d (%s)", status, output))
|
|
| 1668 |
+ |
|
| 1669 |
+ output, status, _ = dockerCmdWithError("run", "--rm", "--net=user", "--network=user", "busybox", "true")
|
|
| 1670 |
+ c.Assert(status, checker.Equals, 0, check.Commentf("unexpected status code %d (%s)", status, output))
|
|
| 1671 |
+ |
|
| 1672 |
+ output, status, _ = dockerCmdWithError("run", "--rm", "--network=user", "--net-alias=foo", "--network-alias=bar", "busybox", "true")
|
|
| 1673 |
+ c.Assert(status, checker.Equals, 0, check.Commentf("unexpected status code %d (%s)", status, output))
|
|
| 1674 |
+} |
| ... | ... |
@@ -52,8 +52,8 @@ docker-create - Create a new container |
| 52 | 52 |
[**--memory-swap**[=*LIMIT*]] |
| 53 | 53 |
[**--memory-swappiness**[=*MEMORY-SWAPPINESS*]] |
| 54 | 54 |
[**--name**[=*NAME*]] |
| 55 |
-[**--net**[=*"bridge"*]] |
|
| 56 |
-[**--net-alias**[=*[]*]] |
|
| 55 |
+[**--network-alias**[=*[]*]] |
|
| 56 |
+[**--network**[=*"bridge"*]] |
|
| 57 | 57 |
[**--oom-kill-disable**] |
| 58 | 58 |
[**--oom-score-adj**[=*0*]] |
| 59 | 59 |
[**-P**|**--publish-all**] |
| ... | ... |
@@ -276,7 +276,7 @@ unit, `b` is used. Set LIMIT to `-1` to enable unlimited swap. |
| 276 | 276 |
'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. |
| 277 | 277 |
'<network-name>|<network-id>': connect to a user-defined network |
| 278 | 278 |
|
| 279 |
-**--net-alias**=[] |
|
| 279 |
+**--network-alias**=[] |
|
| 280 | 280 |
Add network-scoped alias for the container |
| 281 | 281 |
|
| 282 | 282 |
**--oom-kill-disable**=*true*|*false* |
| ... | ... |
@@ -54,8 +54,8 @@ docker-run - Run a command in a new container |
| 54 | 54 |
[**--memory-swap**[=*LIMIT*]] |
| 55 | 55 |
[**--memory-swappiness**[=*MEMORY-SWAPPINESS*]] |
| 56 | 56 |
[**--name**[=*NAME*]] |
| 57 |
-[**--net**[=*"bridge"*]] |
|
| 58 |
-[**--net-alias**[=*[]*]] |
|
| 57 |
+[**--network-alias**[=*[]*]] |
|
| 58 |
+[**--network**[=*"bridge"*]] |
|
| 59 | 59 |
[**--oom-kill-disable**] |
| 60 | 60 |
[**--oom-score-adj**[=*0*]] |
| 61 | 61 |
[**-P**|**--publish-all**] |
| ... | ... |
@@ -395,7 +395,7 @@ and foreground Docker containers. |
| 395 | 395 |
'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. |
| 396 | 396 |
'<network-name>|<network-id>': connect to a user-defined network |
| 397 | 397 |
|
| 398 |
-**--net-alias**=[] |
|
| 398 |
+**--network-alias**=[] |
|
| 399 | 399 |
Add network-scoped alias for the container |
| 400 | 400 |
|
| 401 | 401 |
**--oom-kill-disable**=*true*|*false* |
| ... | ... |
@@ -55,54 +55,54 @@ type ContainerOptions struct {
|
| 55 | 55 |
flStorageOpt opts.ListOpts |
| 56 | 56 |
flLabelsFile opts.ListOpts |
| 57 | 57 |
flLoggingOpts opts.ListOpts |
| 58 |
- flPrivileged *bool |
|
| 59 |
- flPidMode *string |
|
| 60 |
- flUTSMode *string |
|
| 61 |
- flUsernsMode *string |
|
| 62 |
- flPublishAll *bool |
|
| 63 |
- flStdin *bool |
|
| 64 |
- flTty *bool |
|
| 65 |
- flOomKillDisable *bool |
|
| 66 |
- flOomScoreAdj *int |
|
| 67 |
- flContainerIDFile *string |
|
| 68 |
- flEntrypoint *string |
|
| 69 |
- flHostname *string |
|
| 70 |
- flMemoryString *string |
|
| 71 |
- flMemoryReservation *string |
|
| 72 |
- flMemorySwap *string |
|
| 73 |
- flKernelMemory *string |
|
| 74 |
- flUser *string |
|
| 75 |
- flWorkingDir *string |
|
| 76 |
- flCPUShares *int64 |
|
| 77 |
- flCPUPercent *int64 |
|
| 78 |
- flCPUPeriod *int64 |
|
| 79 |
- flCPUQuota *int64 |
|
| 80 |
- flCpusetCpus *string |
|
| 81 |
- flCpusetMems *string |
|
| 82 |
- flBlkioWeight *uint16 |
|
| 83 |
- flIOMaxBandwidth *string |
|
| 84 |
- flIOMaxIOps *uint64 |
|
| 85 |
- flSwappiness *int64 |
|
| 86 |
- flNetMode *string |
|
| 87 |
- flMacAddress *string |
|
| 88 |
- flIPv4Address *string |
|
| 89 |
- flIPv6Address *string |
|
| 90 |
- flIpcMode *string |
|
| 91 |
- flPidsLimit *int64 |
|
| 92 |
- flRestartPolicy *string |
|
| 93 |
- flReadonlyRootfs *bool |
|
| 94 |
- flLoggingDriver *string |
|
| 95 |
- flCgroupParent *string |
|
| 96 |
- flVolumeDriver *string |
|
| 97 |
- flStopSignal *string |
|
| 98 |
- flIsolation *string |
|
| 99 |
- flShmSize *string |
|
| 100 |
- flNoHealthcheck *bool |
|
| 101 |
- flHealthCmd *string |
|
| 102 |
- flHealthInterval *time.Duration |
|
| 103 |
- flHealthTimeout *time.Duration |
|
| 104 |
- flHealthRetries *int |
|
| 105 |
- flRuntime *string |
|
| 58 |
+ flPrivileged bool |
|
| 59 |
+ flPidMode string |
|
| 60 |
+ flUTSMode string |
|
| 61 |
+ flUsernsMode string |
|
| 62 |
+ flPublishAll bool |
|
| 63 |
+ flStdin bool |
|
| 64 |
+ flTty bool |
|
| 65 |
+ flOomKillDisable bool |
|
| 66 |
+ flOomScoreAdj int |
|
| 67 |
+ flContainerIDFile string |
|
| 68 |
+ flEntrypoint string |
|
| 69 |
+ flHostname string |
|
| 70 |
+ flMemoryString string |
|
| 71 |
+ flMemoryReservation string |
|
| 72 |
+ flMemorySwap string |
|
| 73 |
+ flKernelMemory string |
|
| 74 |
+ flUser string |
|
| 75 |
+ flWorkingDir string |
|
| 76 |
+ flCPUShares int64 |
|
| 77 |
+ flCPUPercent int64 |
|
| 78 |
+ flCPUPeriod int64 |
|
| 79 |
+ flCPUQuota int64 |
|
| 80 |
+ flCpusetCpus string |
|
| 81 |
+ flCpusetMems string |
|
| 82 |
+ flBlkioWeight uint16 |
|
| 83 |
+ flIOMaxBandwidth string |
|
| 84 |
+ flIOMaxIOps uint64 |
|
| 85 |
+ flSwappiness int64 |
|
| 86 |
+ flNetMode string |
|
| 87 |
+ flMacAddress string |
|
| 88 |
+ flIPv4Address string |
|
| 89 |
+ flIPv6Address string |
|
| 90 |
+ flIpcMode string |
|
| 91 |
+ flPidsLimit int64 |
|
| 92 |
+ flRestartPolicy string |
|
| 93 |
+ flReadonlyRootfs bool |
|
| 94 |
+ flLoggingDriver string |
|
| 95 |
+ flCgroupParent string |
|
| 96 |
+ flVolumeDriver string |
|
| 97 |
+ flStopSignal string |
|
| 98 |
+ flIsolation string |
|
| 99 |
+ flShmSize string |
|
| 100 |
+ flNoHealthcheck bool |
|
| 101 |
+ flHealthCmd string |
|
| 102 |
+ flHealthInterval time.Duration |
|
| 103 |
+ flHealthTimeout time.Duration |
|
| 104 |
+ flHealthRetries int |
|
| 105 |
+ flRuntime string |
|
| 106 | 106 |
|
| 107 | 107 |
Image string |
| 108 | 108 |
Args []string |
| ... | ... |
@@ -111,122 +111,137 @@ type ContainerOptions struct {
|
| 111 | 111 |
// AddFlags adds all command line flags that will be used by Parse to the FlagSet |
| 112 | 112 |
func AddFlags(flags *pflag.FlagSet) *ContainerOptions {
|
| 113 | 113 |
copts := &ContainerOptions{
|
| 114 |
+ flAliases: opts.NewListOpts(nil), |
|
| 114 | 115 |
flAttach: opts.NewListOpts(ValidateAttach), |
| 115 |
- flVolumes: opts.NewListOpts(nil), |
|
| 116 |
- flTmpfs: opts.NewListOpts(nil), |
|
| 117 | 116 |
flBlkioWeightDevice: NewWeightdeviceOpt(ValidateWeightDevice), |
| 117 |
+ flCapAdd: opts.NewListOpts(nil), |
|
| 118 |
+ flCapDrop: opts.NewListOpts(nil), |
|
| 119 |
+ flDNS: opts.NewListOpts(opts.ValidateIPAddress), |
|
| 120 |
+ flDNSOptions: opts.NewListOpts(nil), |
|
| 121 |
+ flDNSSearch: opts.NewListOpts(opts.ValidateDNSSearch), |
|
| 118 | 122 |
flDeviceReadBps: NewThrottledeviceOpt(ValidateThrottleBpsDevice), |
| 119 |
- flDeviceWriteBps: NewThrottledeviceOpt(ValidateThrottleBpsDevice), |
|
| 120 |
- flLinks: opts.NewListOpts(ValidateLink), |
|
| 121 |
- flAliases: opts.NewListOpts(nil), |
|
| 122 |
- flLinkLocalIPs: opts.NewListOpts(nil), |
|
| 123 | 123 |
flDeviceReadIOps: NewThrottledeviceOpt(ValidateThrottleIOpsDevice), |
| 124 |
+ flDeviceWriteBps: NewThrottledeviceOpt(ValidateThrottleBpsDevice), |
|
| 124 | 125 |
flDeviceWriteIOps: NewThrottledeviceOpt(ValidateThrottleIOpsDevice), |
| 126 |
+ flDevices: opts.NewListOpts(ValidateDevice), |
|
| 125 | 127 |
flEnv: opts.NewListOpts(ValidateEnv), |
| 128 |
+ flEnvFile: opts.NewListOpts(nil), |
|
| 129 |
+ flExpose: opts.NewListOpts(nil), |
|
| 130 |
+ flExtraHosts: opts.NewListOpts(ValidateExtraHost), |
|
| 131 |
+ flGroupAdd: opts.NewListOpts(nil), |
|
| 126 | 132 |
flLabels: opts.NewListOpts(ValidateEnv), |
| 127 |
- flDevices: opts.NewListOpts(ValidateDevice), |
|
| 128 |
- |
|
| 129 |
- flUlimits: NewUlimitOpt(nil), |
|
| 130 |
- flSysctls: opts.NewMapOpts(nil, opts.ValidateSysctl), |
|
| 131 |
- |
|
| 132 |
- flPublish: opts.NewListOpts(nil), |
|
| 133 |
- flExpose: opts.NewListOpts(nil), |
|
| 134 |
- flDNS: opts.NewListOpts(opts.ValidateIPAddress), |
|
| 135 |
- flDNSSearch: opts.NewListOpts(opts.ValidateDNSSearch), |
|
| 136 |
- flDNSOptions: opts.NewListOpts(nil), |
|
| 137 |
- flExtraHosts: opts.NewListOpts(ValidateExtraHost), |
|
| 138 |
- flVolumesFrom: opts.NewListOpts(nil), |
|
| 139 |
- flEnvFile: opts.NewListOpts(nil), |
|
| 140 |
- flCapAdd: opts.NewListOpts(nil), |
|
| 141 |
- flCapDrop: opts.NewListOpts(nil), |
|
| 142 |
- flGroupAdd: opts.NewListOpts(nil), |
|
| 143 |
- flSecurityOpt: opts.NewListOpts(nil), |
|
| 144 |
- flStorageOpt: opts.NewListOpts(nil), |
|
| 145 |
- flLabelsFile: opts.NewListOpts(nil), |
|
| 146 |
- flLoggingOpts: opts.NewListOpts(nil), |
|
| 147 |
- |
|
| 148 |
- flPrivileged: flags.Bool("privileged", false, "Give extended privileges to this container"),
|
|
| 149 |
- flPidMode: flags.String("pid", "", "PID namespace to use"),
|
|
| 150 |
- flUTSMode: flags.String("uts", "", "UTS namespace to use"),
|
|
| 151 |
- flUsernsMode: flags.String("userns", "", "User namespace to use"),
|
|
| 152 |
- flPublishAll: flags.BoolP("publish-all", "P", false, "Publish all exposed ports to random ports"),
|
|
| 153 |
- flStdin: flags.BoolP("interactive", "i", false, "Keep STDIN open even if not attached"),
|
|
| 154 |
- flTty: flags.BoolP("tty", "t", false, "Allocate a pseudo-TTY"),
|
|
| 155 |
- flOomKillDisable: flags.Bool("oom-kill-disable", false, "Disable OOM Killer"),
|
|
| 156 |
- flOomScoreAdj: flags.Int("oom-score-adj", 0, "Tune host's OOM preferences (-1000 to 1000)"),
|
|
| 157 |
- flContainerIDFile: flags.String("cidfile", "", "Write the container ID to the file"),
|
|
| 158 |
- flEntrypoint: flags.String("entrypoint", "", "Overwrite the default ENTRYPOINT of the image"),
|
|
| 159 |
- flHostname: flags.StringP("hostname", "h", "", "Container host name"),
|
|
| 160 |
- flMemoryString: flags.StringP("memory", "m", "", "Memory limit"),
|
|
| 161 |
- flMemoryReservation: flags.String("memory-reservation", "", "Memory soft limit"),
|
|
| 162 |
- flMemorySwap: flags.String("memory-swap", "", "Swap limit equal to memory plus swap: '-1' to enable unlimited swap"),
|
|
| 163 |
- flKernelMemory: flags.String("kernel-memory", "", "Kernel memory limit"),
|
|
| 164 |
- flUser: flags.StringP("user", "u", "", "Username or UID (format: <name|uid>[:<group|gid>])"),
|
|
| 165 |
- flWorkingDir: flags.StringP("workdir", "w", "", "Working directory inside the container"),
|
|
| 166 |
- flCPUShares: flags.Int64P("cpu-shares", "c", 0, "CPU shares (relative weight)"),
|
|
| 167 |
- flCPUPercent: flags.Int64("cpu-percent", 0, "CPU percent (Windows only)"),
|
|
| 168 |
- flCPUPeriod: flags.Int64("cpu-period", 0, "Limit CPU CFS (Completely Fair Scheduler) period"),
|
|
| 169 |
- flCPUQuota: flags.Int64("cpu-quota", 0, "Limit CPU CFS (Completely Fair Scheduler) quota"),
|
|
| 170 |
- flCpusetCpus: flags.String("cpuset-cpus", "", "CPUs in which to allow execution (0-3, 0,1)"),
|
|
| 171 |
- flCpusetMems: flags.String("cpuset-mems", "", "MEMs in which to allow execution (0-3, 0,1)"),
|
|
| 172 |
- flBlkioWeight: flags.Uint16("blkio-weight", 0, "Block IO (relative weight), between 10 and 1000"),
|
|
| 173 |
- flIOMaxBandwidth: flags.String("io-maxbandwidth", "", "Maximum IO bandwidth limit for the system drive (Windows only)"),
|
|
| 174 |
- flIOMaxIOps: flags.Uint64("io-maxiops", 0, "Maximum IOps limit for the system drive (Windows only)"),
|
|
| 175 |
- flSwappiness: flags.Int64("memory-swappiness", -1, "Tune container memory swappiness (0 to 100)"),
|
|
| 176 |
- flNetMode: flags.String("net", "default", "Connect a container to a network"),
|
|
| 177 |
- flMacAddress: flags.String("mac-address", "", "Container MAC address (e.g. 92:d0:c6:0a:29:33)"),
|
|
| 178 |
- flIPv4Address: flags.String("ip", "", "Container IPv4 address (e.g. 172.30.100.104)"),
|
|
| 179 |
- flIPv6Address: flags.String("ip6", "", "Container IPv6 address (e.g. 2001:db8::33)"),
|
|
| 180 |
- flIpcMode: flags.String("ipc", "", "IPC namespace to use"),
|
|
| 181 |
- flPidsLimit: flags.Int64("pids-limit", 0, "Tune container pids limit (set -1 for unlimited)"),
|
|
| 182 |
- flRestartPolicy: flags.String("restart", "no", "Restart policy to apply when a container exits"),
|
|
| 183 |
- flReadonlyRootfs: flags.Bool("read-only", false, "Mount the container's root filesystem as read only"),
|
|
| 184 |
- flLoggingDriver: flags.String("log-driver", "", "Logging driver for container"),
|
|
| 185 |
- flCgroupParent: flags.String("cgroup-parent", "", "Optional parent cgroup for the container"),
|
|
| 186 |
- flVolumeDriver: flags.String("volume-driver", "", "Optional volume driver for the container"),
|
|
| 187 |
- flStopSignal: flags.String("stop-signal", signal.DefaultStopSignal, fmt.Sprintf("Signal to stop a container, %v by default", signal.DefaultStopSignal)),
|
|
| 188 |
- flIsolation: flags.String("isolation", "", "Container isolation technology"),
|
|
| 189 |
- flShmSize: flags.String("shm-size", "", "Size of /dev/shm, default value is 64MB"),
|
|
| 190 |
- flNoHealthcheck: flags.Bool("no-healthcheck", false, "Disable any container-specified HEALTHCHECK"),
|
|
| 191 |
- flHealthCmd: flags.String("health-cmd", "", "Command to run to check health"),
|
|
| 192 |
- flHealthInterval: flags.Duration("health-interval", 0, "Time between running the check"),
|
|
| 193 |
- flHealthTimeout: flags.Duration("health-timeout", 0, "Maximum time to allow one check to run"),
|
|
| 194 |
- flHealthRetries: flags.Int("health-retries", 0, "Consecutive failures needed to report unhealthy"),
|
|
| 195 |
- flRuntime: flags.String("runtime", "", "Runtime to use for this container"),
|
|
| 133 |
+ flLabelsFile: opts.NewListOpts(nil), |
|
| 134 |
+ flLinkLocalIPs: opts.NewListOpts(nil), |
|
| 135 |
+ flLinks: opts.NewListOpts(ValidateLink), |
|
| 136 |
+ flLoggingOpts: opts.NewListOpts(nil), |
|
| 137 |
+ flPublish: opts.NewListOpts(nil), |
|
| 138 |
+ flSecurityOpt: opts.NewListOpts(nil), |
|
| 139 |
+ flStorageOpt: opts.NewListOpts(nil), |
|
| 140 |
+ flSysctls: opts.NewMapOpts(nil, opts.ValidateSysctl), |
|
| 141 |
+ flTmpfs: opts.NewListOpts(nil), |
|
| 142 |
+ flUlimits: NewUlimitOpt(nil), |
|
| 143 |
+ flVolumes: opts.NewListOpts(nil), |
|
| 144 |
+ flVolumesFrom: opts.NewListOpts(nil), |
|
| 196 | 145 |
} |
| 197 | 146 |
|
| 147 |
+ // General purpose flags |
|
| 198 | 148 |
flags.VarP(&copts.flAttach, "attach", "a", "Attach to STDIN, STDOUT or STDERR") |
| 199 |
- flags.Var(&copts.flBlkioWeightDevice, "blkio-weight-device", "Block IO weight (relative device weight)") |
|
| 200 |
- flags.Var(&copts.flDeviceReadBps, "device-read-bps", "Limit read rate (bytes per second) from a device") |
|
| 201 |
- flags.Var(&copts.flDeviceWriteBps, "device-write-bps", "Limit write rate (bytes per second) to a device") |
|
| 202 |
- flags.Var(&copts.flDeviceReadIOps, "device-read-iops", "Limit read rate (IO per second) from a device") |
|
| 203 |
- flags.Var(&copts.flDeviceWriteIOps, "device-write-iops", "Limit write rate (IO per second) to a device") |
|
| 204 |
- flags.VarP(&copts.flVolumes, "volume", "v", "Bind mount a volume") |
|
| 205 |
- flags.Var(&copts.flTmpfs, "tmpfs", "Mount a tmpfs directory") |
|
| 206 |
- flags.Var(&copts.flLinks, "link", "Add link to another container") |
|
| 207 |
- flags.Var(&copts.flAliases, "net-alias", "Add network-scoped alias for the container") |
|
| 208 |
- flags.Var(&copts.flLinkLocalIPs, "link-local-ip", "Container IPv4/IPv6 link-local addresses") |
|
| 209 | 149 |
flags.Var(&copts.flDevices, "device", "Add a host device to the container") |
| 210 |
- flags.VarP(&copts.flLabels, "label", "l", "Set meta data on a container") |
|
| 211 |
- flags.Var(&copts.flLabelsFile, "label-file", "Read in a line delimited file of labels") |
|
| 212 | 150 |
flags.VarP(&copts.flEnv, "env", "e", "Set environment variables") |
| 213 | 151 |
flags.Var(&copts.flEnvFile, "env-file", "Read in a file of environment variables") |
| 214 |
- flags.VarP(&copts.flPublish, "publish", "p", "Publish a container's port(s) to the host") |
|
| 215 |
- flags.Var(&copts.flExpose, "expose", "Expose a port or a range of ports") |
|
| 216 |
- flags.Var(&copts.flDNS, "dns", "Set custom DNS servers") |
|
| 217 |
- flags.Var(&copts.flDNSSearch, "dns-search", "Set custom DNS search domains") |
|
| 218 |
- flags.Var(&copts.flDNSOptions, "dns-opt", "Set DNS options") |
|
| 219 |
- flags.Var(&copts.flExtraHosts, "add-host", "Add a custom host-to-IP mapping (host:ip)") |
|
| 220 |
- flags.Var(&copts.flVolumesFrom, "volumes-from", "Mount volumes from the specified container(s)") |
|
| 152 |
+ flags.StringVar(&copts.flEntrypoint, "entrypoint", "", "Overwrite the default ENTRYPOINT of the image") |
|
| 153 |
+ flags.Var(&copts.flGroupAdd, "group-add", "Add additional groups to join") |
|
| 154 |
+ flags.StringVarP(&copts.flHostname, "hostname", "h", "", "Container host name") |
|
| 155 |
+ flags.BoolVarP(&copts.flStdin, "interactive", "i", false, "Keep STDIN open even if not attached") |
|
| 156 |
+ flags.VarP(&copts.flLabels, "label", "l", "Set meta data on a container") |
|
| 157 |
+ flags.Var(&copts.flLabelsFile, "label-file", "Read in a line delimited file of labels") |
|
| 158 |
+ flags.BoolVar(&copts.flReadonlyRootfs, "read-only", false, "Mount the container's root filesystem as read only") |
|
| 159 |
+ flags.StringVar(&copts.flRestartPolicy, "restart", "no", "Restart policy to apply when a container exits") |
|
| 160 |
+ flags.StringVar(&copts.flStopSignal, "stop-signal", signal.DefaultStopSignal, fmt.Sprintf("Signal to stop a container, %v by default", signal.DefaultStopSignal))
|
|
| 161 |
+ flags.Var(copts.flSysctls, "sysctl", "Sysctl options") |
|
| 162 |
+ flags.BoolVarP(&copts.flTty, "tty", "t", false, "Allocate a pseudo-TTY") |
|
| 163 |
+ flags.Var(copts.flUlimits, "ulimit", "Ulimit options") |
|
| 164 |
+ flags.StringVarP(&copts.flUser, "user", "u", "", "Username or UID (format: <name|uid>[:<group|gid>])") |
|
| 165 |
+ flags.StringVarP(&copts.flWorkingDir, "workdir", "w", "", "Working directory inside the container") |
|
| 166 |
+ |
|
| 167 |
+ // Security |
|
| 221 | 168 |
flags.Var(&copts.flCapAdd, "cap-add", "Add Linux capabilities") |
| 222 | 169 |
flags.Var(&copts.flCapDrop, "cap-drop", "Drop Linux capabilities") |
| 223 |
- flags.Var(&copts.flGroupAdd, "group-add", "Add additional groups to join") |
|
| 170 |
+ flags.BoolVar(&copts.flPrivileged, "privileged", false, "Give extended privileges to this container") |
|
| 224 | 171 |
flags.Var(&copts.flSecurityOpt, "security-opt", "Security Options") |
| 225 |
- flags.Var(&copts.flStorageOpt, "storage-opt", "Set storage driver options per container") |
|
| 226 |
- flags.Var(copts.flUlimits, "ulimit", "Ulimit options") |
|
| 227 |
- flags.Var(copts.flSysctls, "sysctl", "Sysctl options") |
|
| 172 |
+ flags.StringVar(&copts.flUsernsMode, "userns", "", "User namespace to use") |
|
| 173 |
+ |
|
| 174 |
+ // Network and port publishing flag |
|
| 175 |
+ flags.Var(&copts.flExtraHosts, "add-host", "Add a custom host-to-IP mapping (host:ip)") |
|
| 176 |
+ flags.Var(&copts.flDNS, "dns", "Set custom DNS servers") |
|
| 177 |
+ flags.Var(&copts.flDNSOptions, "dns-opt", "Set DNS options") |
|
| 178 |
+ flags.Var(&copts.flDNSSearch, "dns-search", "Set custom DNS search domains") |
|
| 179 |
+ flags.Var(&copts.flExpose, "expose", "Expose a port or a range of ports") |
|
| 180 |
+ flags.StringVar(&copts.flIPv4Address, "ip", "", "Container IPv4 address (e.g. 172.30.100.104)") |
|
| 181 |
+ flags.StringVar(&copts.flIPv6Address, "ip6", "", "Container IPv6 address (e.g. 2001:db8::33)") |
|
| 182 |
+ flags.Var(&copts.flLinks, "link", "Add link to another container") |
|
| 183 |
+ flags.Var(&copts.flLinkLocalIPs, "link-local-ip", "Container IPv4/IPv6 link-local addresses") |
|
| 184 |
+ flags.StringVar(&copts.flMacAddress, "mac-address", "", "Container MAC address (e.g. 92:d0:c6:0a:29:33)") |
|
| 185 |
+ flags.VarP(&copts.flPublish, "publish", "p", "Publish a container's port(s) to the host") |
|
| 186 |
+ flags.BoolVarP(&copts.flPublishAll, "publish-all", "P", false, "Publish all exposed ports to random ports") |
|
| 187 |
+ // We allow for both "--net" and "--network", although the latter is the recommended way. |
|
| 188 |
+ flags.StringVar(&copts.flNetMode, "net", "default", "Connect a container to a network") |
|
| 189 |
+ flags.StringVar(&copts.flNetMode, "network", "default", "Connect a container to a network") |
|
| 190 |
+ flags.MarkHidden("net")
|
|
| 191 |
+ // We allow for both "--net-alias" and "--network-alias", although the latter is the recommended way. |
|
| 192 |
+ flags.Var(&copts.flAliases, "net-alias", "Add network-scoped alias for the container") |
|
| 193 |
+ flags.Var(&copts.flAliases, "network-alias", "Add network-scoped alias for the container") |
|
| 194 |
+ flags.MarkHidden("net-alias")
|
|
| 195 |
+ |
|
| 196 |
+ // Logging and storage |
|
| 197 |
+ flags.StringVar(&copts.flLoggingDriver, "log-driver", "", "Logging driver for container") |
|
| 198 |
+ flags.StringVar(&copts.flVolumeDriver, "volume-driver", "", "Optional volume driver for the container") |
|
| 228 | 199 |
flags.Var(&copts.flLoggingOpts, "log-opt", "Log driver options") |
| 200 |
+ flags.Var(&copts.flStorageOpt, "storage-opt", "Set storage driver options per container") |
|
| 201 |
+ flags.Var(&copts.flTmpfs, "tmpfs", "Mount a tmpfs directory") |
|
| 202 |
+ flags.Var(&copts.flVolumesFrom, "volumes-from", "Mount volumes from the specified container(s)") |
|
| 203 |
+ flags.VarP(&copts.flVolumes, "volume", "v", "Bind mount a volume") |
|
| 229 | 204 |
|
| 205 |
+ // Health-checking |
|
| 206 |
+ flags.StringVar(&copts.flHealthCmd, "health-cmd", "", "Command to run to check health") |
|
| 207 |
+ flags.DurationVar(&copts.flHealthInterval, "health-interval", 0, "Time between running the check") |
|
| 208 |
+ flags.IntVar(&copts.flHealthRetries, "health-retries", 0, "Consecutive failures needed to report unhealthy") |
|
| 209 |
+ flags.DurationVar(&copts.flHealthTimeout, "health-timeout", 0, "Maximum time to allow one check to run") |
|
| 210 |
+ flags.BoolVar(&copts.flNoHealthcheck, "no-healthcheck", false, "Disable any container-specified HEALTHCHECK") |
|
| 211 |
+ |
|
| 212 |
+ // Resource management |
|
| 213 |
+ flags.Uint16Var(&copts.flBlkioWeight, "blkio-weight", 0, "Block IO (relative weight), between 10 and 1000") |
|
| 214 |
+ flags.Var(&copts.flBlkioWeightDevice, "blkio-weight-device", "Block IO weight (relative device weight)") |
|
| 215 |
+ flags.StringVar(&copts.flContainerIDFile, "cidfile", "", "Write the container ID to the file") |
|
| 216 |
+ flags.StringVar(&copts.flCpusetCpus, "cpuset-cpus", "", "CPUs in which to allow execution (0-3, 0,1)") |
|
| 217 |
+ flags.StringVar(&copts.flCpusetMems, "cpuset-mems", "", "MEMs in which to allow execution (0-3, 0,1)") |
|
| 218 |
+ flags.Int64Var(&copts.flCPUPercent, "cpu-percent", 0, "CPU percent (Windows only)") |
|
| 219 |
+ flags.Int64Var(&copts.flCPUPeriod, "cpu-period", 0, "Limit CPU CFS (Completely Fair Scheduler) period") |
|
| 220 |
+ flags.Int64Var(&copts.flCPUQuota, "cpu-quota", 0, "Limit CPU CFS (Completely Fair Scheduler) quota") |
|
| 221 |
+ flags.Int64VarP(&copts.flCPUShares, "cpu-shares", "c", 0, "CPU shares (relative weight)") |
|
| 222 |
+ flags.Var(&copts.flDeviceReadBps, "device-read-bps", "Limit read rate (bytes per second) from a device") |
|
| 223 |
+ flags.Var(&copts.flDeviceReadIOps, "device-read-iops", "Limit read rate (IO per second) from a device") |
|
| 224 |
+ flags.Var(&copts.flDeviceWriteBps, "device-write-bps", "Limit write rate (bytes per second) to a device") |
|
| 225 |
+ flags.Var(&copts.flDeviceWriteIOps, "device-write-iops", "Limit write rate (IO per second) to a device") |
|
| 226 |
+ flags.StringVar(&copts.flIOMaxBandwidth, "io-maxbandwidth", "", "Maximum IO bandwidth limit for the system drive (Windows only)") |
|
| 227 |
+ flags.Uint64Var(&copts.flIOMaxIOps, "io-maxiops", 0, "Maximum IOps limit for the system drive (Windows only)") |
|
| 228 |
+ flags.StringVar(&copts.flKernelMemory, "kernel-memory", "", "Kernel memory limit") |
|
| 229 |
+ flags.StringVarP(&copts.flMemoryString, "memory", "m", "", "Memory limit") |
|
| 230 |
+ flags.StringVar(&copts.flMemoryReservation, "memory-reservation", "", "Memory soft limit") |
|
| 231 |
+ flags.StringVar(&copts.flMemorySwap, "memory-swap", "", "Swap limit equal to memory plus swap: '-1' to enable unlimited swap") |
|
| 232 |
+ flags.Int64Var(&copts.flSwappiness, "memory-swappiness", -1, "Tune container memory swappiness (0 to 100)") |
|
| 233 |
+ flags.BoolVar(&copts.flOomKillDisable, "oom-kill-disable", false, "Disable OOM Killer") |
|
| 234 |
+ flags.IntVar(&copts.flOomScoreAdj, "oom-score-adj", 0, "Tune host's OOM preferences (-1000 to 1000)") |
|
| 235 |
+ flags.Int64Var(&copts.flPidsLimit, "pids-limit", 0, "Tune container pids limit (set -1 for unlimited)") |
|
| 236 |
+ |
|
| 237 |
+ // Low-level execution (cgroups, namespaces, ...) |
|
| 238 |
+ flags.StringVar(&copts.flCgroupParent, "cgroup-parent", "", "Optional parent cgroup for the container") |
|
| 239 |
+ flags.StringVar(&copts.flIpcMode, "ipc", "", "IPC namespace to use") |
|
| 240 |
+ flags.StringVar(&copts.flIsolation, "isolation", "", "Container isolation technology") |
|
| 241 |
+ flags.StringVar(&copts.flPidMode, "pid", "", "PID namespace to use") |
|
| 242 |
+ flags.StringVar(&copts.flShmSize, "shm-size", "", "Size of /dev/shm, default value is 64MB") |
|
| 243 |
+ flags.StringVar(&copts.flUTSMode, "uts", "", "UTS namespace to use") |
|
| 244 |
+ flags.StringVar(&copts.flRuntime, "runtime", "", "Runtime to use for this container") |
|
| 230 | 245 |
return copts |
| 231 | 246 |
} |
| 232 | 247 |
|
| ... | ... |
@@ -241,12 +256,12 @@ func Parse(flags *pflag.FlagSet, copts *ContainerOptions) (*container.Config, *c |
| 241 | 241 |
) |
| 242 | 242 |
|
| 243 | 243 |
// Validate the input mac address |
| 244 |
- if *copts.flMacAddress != "" {
|
|
| 245 |
- if _, err := ValidateMACAddress(*copts.flMacAddress); err != nil {
|
|
| 246 |
- return nil, nil, nil, fmt.Errorf("%s is not a valid mac address", *copts.flMacAddress)
|
|
| 244 |
+ if copts.flMacAddress != "" {
|
|
| 245 |
+ if _, err := ValidateMACAddress(copts.flMacAddress); err != nil {
|
|
| 246 |
+ return nil, nil, nil, fmt.Errorf("%s is not a valid mac address", copts.flMacAddress)
|
|
| 247 | 247 |
} |
| 248 | 248 |
} |
| 249 |
- if *copts.flStdin {
|
|
| 249 |
+ if copts.flStdin {
|
|
| 250 | 250 |
attachStdin = true |
| 251 | 251 |
} |
| 252 | 252 |
// If -a is not set, attach to stdout and stderr |
| ... | ... |
@@ -258,27 +273,27 @@ func Parse(flags *pflag.FlagSet, copts *ContainerOptions) (*container.Config, *c |
| 258 | 258 |
var err error |
| 259 | 259 |
|
| 260 | 260 |
var flMemory int64 |
| 261 |
- if *copts.flMemoryString != "" {
|
|
| 262 |
- flMemory, err = units.RAMInBytes(*copts.flMemoryString) |
|
| 261 |
+ if copts.flMemoryString != "" {
|
|
| 262 |
+ flMemory, err = units.RAMInBytes(copts.flMemoryString) |
|
| 263 | 263 |
if err != nil {
|
| 264 | 264 |
return nil, nil, nil, err |
| 265 | 265 |
} |
| 266 | 266 |
} |
| 267 | 267 |
|
| 268 | 268 |
var MemoryReservation int64 |
| 269 |
- if *copts.flMemoryReservation != "" {
|
|
| 270 |
- MemoryReservation, err = units.RAMInBytes(*copts.flMemoryReservation) |
|
| 269 |
+ if copts.flMemoryReservation != "" {
|
|
| 270 |
+ MemoryReservation, err = units.RAMInBytes(copts.flMemoryReservation) |
|
| 271 | 271 |
if err != nil {
|
| 272 | 272 |
return nil, nil, nil, err |
| 273 | 273 |
} |
| 274 | 274 |
} |
| 275 | 275 |
|
| 276 | 276 |
var memorySwap int64 |
| 277 |
- if *copts.flMemorySwap != "" {
|
|
| 278 |
- if *copts.flMemorySwap == "-1" {
|
|
| 277 |
+ if copts.flMemorySwap != "" {
|
|
| 278 |
+ if copts.flMemorySwap == "-1" {
|
|
| 279 | 279 |
memorySwap = -1 |
| 280 | 280 |
} else {
|
| 281 |
- memorySwap, err = units.RAMInBytes(*copts.flMemorySwap) |
|
| 281 |
+ memorySwap, err = units.RAMInBytes(copts.flMemorySwap) |
|
| 282 | 282 |
if err != nil {
|
| 283 | 283 |
return nil, nil, nil, err |
| 284 | 284 |
} |
| ... | ... |
@@ -286,21 +301,21 @@ func Parse(flags *pflag.FlagSet, copts *ContainerOptions) (*container.Config, *c |
| 286 | 286 |
} |
| 287 | 287 |
|
| 288 | 288 |
var KernelMemory int64 |
| 289 |
- if *copts.flKernelMemory != "" {
|
|
| 290 |
- KernelMemory, err = units.RAMInBytes(*copts.flKernelMemory) |
|
| 289 |
+ if copts.flKernelMemory != "" {
|
|
| 290 |
+ KernelMemory, err = units.RAMInBytes(copts.flKernelMemory) |
|
| 291 | 291 |
if err != nil {
|
| 292 | 292 |
return nil, nil, nil, err |
| 293 | 293 |
} |
| 294 | 294 |
} |
| 295 | 295 |
|
| 296 |
- swappiness := *copts.flSwappiness |
|
| 296 |
+ swappiness := copts.flSwappiness |
|
| 297 | 297 |
if swappiness != -1 && (swappiness < 0 || swappiness > 100) {
|
| 298 | 298 |
return nil, nil, nil, fmt.Errorf("invalid value: %d. Valid memory swappiness range is 0-100", swappiness)
|
| 299 | 299 |
} |
| 300 | 300 |
|
| 301 | 301 |
var shmSize int64 |
| 302 |
- if *copts.flShmSize != "" {
|
|
| 303 |
- shmSize, err = units.RAMInBytes(*copts.flShmSize) |
|
| 302 |
+ if copts.flShmSize != "" {
|
|
| 303 |
+ shmSize, err = units.RAMInBytes(copts.flShmSize) |
|
| 304 | 304 |
if err != nil {
|
| 305 | 305 |
return nil, nil, nil, err |
| 306 | 306 |
} |
| ... | ... |
@@ -308,13 +323,13 @@ func Parse(flags *pflag.FlagSet, copts *ContainerOptions) (*container.Config, *c |
| 308 | 308 |
|
| 309 | 309 |
// TODO FIXME units.RAMInBytes should have a uint64 version |
| 310 | 310 |
var maxIOBandwidth int64 |
| 311 |
- if *copts.flIOMaxBandwidth != "" {
|
|
| 312 |
- maxIOBandwidth, err = units.RAMInBytes(*copts.flIOMaxBandwidth) |
|
| 311 |
+ if copts.flIOMaxBandwidth != "" {
|
|
| 312 |
+ maxIOBandwidth, err = units.RAMInBytes(copts.flIOMaxBandwidth) |
|
| 313 | 313 |
if err != nil {
|
| 314 | 314 |
return nil, nil, nil, err |
| 315 | 315 |
} |
| 316 | 316 |
if maxIOBandwidth < 0 {
|
| 317 |
- return nil, nil, nil, fmt.Errorf("invalid value: %s. Maximum IO Bandwidth must be positive", *copts.flIOMaxBandwidth)
|
|
| 317 |
+ return nil, nil, nil, fmt.Errorf("invalid value: %s. Maximum IO Bandwidth must be positive", copts.flIOMaxBandwidth)
|
|
| 318 | 318 |
} |
| 319 | 319 |
} |
| 320 | 320 |
|
| ... | ... |
@@ -349,8 +364,8 @@ func Parse(flags *pflag.FlagSet, copts *ContainerOptions) (*container.Config, *c |
| 349 | 349 |
if len(copts.Args) > 0 {
|
| 350 | 350 |
runCmd = strslice.StrSlice(copts.Args) |
| 351 | 351 |
} |
| 352 |
- if *copts.flEntrypoint != "" {
|
|
| 353 |
- entrypoint = strslice.StrSlice{*copts.flEntrypoint}
|
|
| 352 |
+ if copts.flEntrypoint != "" {
|
|
| 353 |
+ entrypoint = strslice.StrSlice{copts.flEntrypoint}
|
|
| 354 | 354 |
} |
| 355 | 355 |
|
| 356 | 356 |
ports, portBindings, err := nat.ParsePortSpecs(copts.flPublish.GetAll()) |
| ... | ... |
@@ -404,32 +419,32 @@ func Parse(flags *pflag.FlagSet, copts *ContainerOptions) (*container.Config, *c |
| 404 | 404 |
return nil, nil, nil, err |
| 405 | 405 |
} |
| 406 | 406 |
|
| 407 |
- ipcMode := container.IpcMode(*copts.flIpcMode) |
|
| 407 |
+ ipcMode := container.IpcMode(copts.flIpcMode) |
|
| 408 | 408 |
if !ipcMode.Valid() {
|
| 409 | 409 |
return nil, nil, nil, fmt.Errorf("--ipc: invalid IPC mode")
|
| 410 | 410 |
} |
| 411 | 411 |
|
| 412 |
- pidMode := container.PidMode(*copts.flPidMode) |
|
| 412 |
+ pidMode := container.PidMode(copts.flPidMode) |
|
| 413 | 413 |
if !pidMode.Valid() {
|
| 414 | 414 |
return nil, nil, nil, fmt.Errorf("--pid: invalid PID mode")
|
| 415 | 415 |
} |
| 416 | 416 |
|
| 417 |
- utsMode := container.UTSMode(*copts.flUTSMode) |
|
| 417 |
+ utsMode := container.UTSMode(copts.flUTSMode) |
|
| 418 | 418 |
if !utsMode.Valid() {
|
| 419 | 419 |
return nil, nil, nil, fmt.Errorf("--uts: invalid UTS mode")
|
| 420 | 420 |
} |
| 421 | 421 |
|
| 422 |
- usernsMode := container.UsernsMode(*copts.flUsernsMode) |
|
| 422 |
+ usernsMode := container.UsernsMode(copts.flUsernsMode) |
|
| 423 | 423 |
if !usernsMode.Valid() {
|
| 424 | 424 |
return nil, nil, nil, fmt.Errorf("--userns: invalid USER mode")
|
| 425 | 425 |
} |
| 426 | 426 |
|
| 427 |
- restartPolicy, err := ParseRestartPolicy(*copts.flRestartPolicy) |
|
| 427 |
+ restartPolicy, err := ParseRestartPolicy(copts.flRestartPolicy) |
|
| 428 | 428 |
if err != nil {
|
| 429 | 429 |
return nil, nil, nil, err |
| 430 | 430 |
} |
| 431 | 431 |
|
| 432 |
- loggingOpts, err := parseLoggingOpts(*copts.flLoggingDriver, copts.flLoggingOpts.GetAll()) |
|
| 432 |
+ loggingOpts, err := parseLoggingOpts(copts.flLoggingDriver, copts.flLoggingOpts.GetAll()) |
|
| 433 | 433 |
if err != nil {
|
| 434 | 434 |
return nil, nil, nil, err |
| 435 | 435 |
} |
| ... | ... |
@@ -446,11 +461,11 @@ func Parse(flags *pflag.FlagSet, copts *ContainerOptions) (*container.Config, *c |
| 446 | 446 |
|
| 447 | 447 |
// Healthcheck |
| 448 | 448 |
var healthConfig *container.HealthConfig |
| 449 |
- haveHealthSettings := *copts.flHealthCmd != "" || |
|
| 450 |
- *copts.flHealthInterval != 0 || |
|
| 451 |
- *copts.flHealthTimeout != 0 || |
|
| 452 |
- *copts.flHealthRetries != 0 |
|
| 453 |
- if *copts.flNoHealthcheck {
|
|
| 449 |
+ haveHealthSettings := copts.flHealthCmd != "" || |
|
| 450 |
+ copts.flHealthInterval != 0 || |
|
| 451 |
+ copts.flHealthTimeout != 0 || |
|
| 452 |
+ copts.flHealthRetries != 0 |
|
| 453 |
+ if copts.flNoHealthcheck {
|
|
| 454 | 454 |
if haveHealthSettings {
|
| 455 | 455 |
return nil, nil, nil, fmt.Errorf("--no-healthcheck conflicts with --health-* options")
|
| 456 | 456 |
} |
| ... | ... |
@@ -458,62 +473,62 @@ func Parse(flags *pflag.FlagSet, copts *ContainerOptions) (*container.Config, *c |
| 458 | 458 |
healthConfig = &container.HealthConfig{Test: test}
|
| 459 | 459 |
} else if haveHealthSettings {
|
| 460 | 460 |
var probe strslice.StrSlice |
| 461 |
- if *copts.flHealthCmd != "" {
|
|
| 462 |
- args := []string{"CMD-SHELL", *copts.flHealthCmd}
|
|
| 461 |
+ if copts.flHealthCmd != "" {
|
|
| 462 |
+ args := []string{"CMD-SHELL", copts.flHealthCmd}
|
|
| 463 | 463 |
probe = strslice.StrSlice(args) |
| 464 | 464 |
} |
| 465 |
- if *copts.flHealthInterval < 0 {
|
|
| 465 |
+ if copts.flHealthInterval < 0 {
|
|
| 466 | 466 |
return nil, nil, nil, fmt.Errorf("--health-interval cannot be negative")
|
| 467 | 467 |
} |
| 468 |
- if *copts.flHealthTimeout < 0 {
|
|
| 468 |
+ if copts.flHealthTimeout < 0 {
|
|
| 469 | 469 |
return nil, nil, nil, fmt.Errorf("--health-timeout cannot be negative")
|
| 470 | 470 |
} |
| 471 | 471 |
|
| 472 | 472 |
healthConfig = &container.HealthConfig{
|
| 473 | 473 |
Test: probe, |
| 474 |
- Interval: *copts.flHealthInterval, |
|
| 475 |
- Timeout: *copts.flHealthTimeout, |
|
| 476 |
- Retries: *copts.flHealthRetries, |
|
| 474 |
+ Interval: copts.flHealthInterval, |
|
| 475 |
+ Timeout: copts.flHealthTimeout, |
|
| 476 |
+ Retries: copts.flHealthRetries, |
|
| 477 | 477 |
} |
| 478 | 478 |
} |
| 479 | 479 |
|
| 480 | 480 |
resources := container.Resources{
|
| 481 |
- CgroupParent: *copts.flCgroupParent, |
|
| 481 |
+ CgroupParent: copts.flCgroupParent, |
|
| 482 | 482 |
Memory: flMemory, |
| 483 | 483 |
MemoryReservation: MemoryReservation, |
| 484 | 484 |
MemorySwap: memorySwap, |
| 485 |
- MemorySwappiness: copts.flSwappiness, |
|
| 485 |
+ MemorySwappiness: &copts.flSwappiness, |
|
| 486 | 486 |
KernelMemory: KernelMemory, |
| 487 |
- OomKillDisable: copts.flOomKillDisable, |
|
| 488 |
- CPUPercent: *copts.flCPUPercent, |
|
| 489 |
- CPUShares: *copts.flCPUShares, |
|
| 490 |
- CPUPeriod: *copts.flCPUPeriod, |
|
| 491 |
- CpusetCpus: *copts.flCpusetCpus, |
|
| 492 |
- CpusetMems: *copts.flCpusetMems, |
|
| 493 |
- CPUQuota: *copts.flCPUQuota, |
|
| 494 |
- PidsLimit: *copts.flPidsLimit, |
|
| 495 |
- BlkioWeight: *copts.flBlkioWeight, |
|
| 487 |
+ OomKillDisable: &copts.flOomKillDisable, |
|
| 488 |
+ CPUPercent: copts.flCPUPercent, |
|
| 489 |
+ CPUShares: copts.flCPUShares, |
|
| 490 |
+ CPUPeriod: copts.flCPUPeriod, |
|
| 491 |
+ CpusetCpus: copts.flCpusetCpus, |
|
| 492 |
+ CpusetMems: copts.flCpusetMems, |
|
| 493 |
+ CPUQuota: copts.flCPUQuota, |
|
| 494 |
+ PidsLimit: copts.flPidsLimit, |
|
| 495 |
+ BlkioWeight: copts.flBlkioWeight, |
|
| 496 | 496 |
BlkioWeightDevice: copts.flBlkioWeightDevice.GetList(), |
| 497 | 497 |
BlkioDeviceReadBps: copts.flDeviceReadBps.GetList(), |
| 498 | 498 |
BlkioDeviceWriteBps: copts.flDeviceWriteBps.GetList(), |
| 499 | 499 |
BlkioDeviceReadIOps: copts.flDeviceReadIOps.GetList(), |
| 500 | 500 |
BlkioDeviceWriteIOps: copts.flDeviceWriteIOps.GetList(), |
| 501 |
- IOMaximumIOps: *copts.flIOMaxIOps, |
|
| 501 |
+ IOMaximumIOps: copts.flIOMaxIOps, |
|
| 502 | 502 |
IOMaximumBandwidth: uint64(maxIOBandwidth), |
| 503 | 503 |
Ulimits: copts.flUlimits.GetList(), |
| 504 | 504 |
Devices: deviceMappings, |
| 505 | 505 |
} |
| 506 | 506 |
|
| 507 | 507 |
config := &container.Config{
|
| 508 |
- Hostname: *copts.flHostname, |
|
| 508 |
+ Hostname: copts.flHostname, |
|
| 509 | 509 |
ExposedPorts: ports, |
| 510 |
- User: *copts.flUser, |
|
| 511 |
- Tty: *copts.flTty, |
|
| 510 |
+ User: copts.flUser, |
|
| 511 |
+ Tty: copts.flTty, |
|
| 512 | 512 |
// TODO: deprecated, it comes from -n, --networking |
| 513 | 513 |
// it's still needed internally to set the network to disabled |
| 514 | 514 |
// if e.g. bridge is none in daemon opts, and in inspect |
| 515 | 515 |
NetworkDisabled: false, |
| 516 |
- OpenStdin: *copts.flStdin, |
|
| 516 |
+ OpenStdin: copts.flStdin, |
|
| 517 | 517 |
AttachStdin: attachStdin, |
| 518 | 518 |
AttachStdout: attachStdout, |
| 519 | 519 |
AttachStderr: attachStderr, |
| ... | ... |
@@ -521,24 +536,24 @@ func Parse(flags *pflag.FlagSet, copts *ContainerOptions) (*container.Config, *c |
| 521 | 521 |
Cmd: runCmd, |
| 522 | 522 |
Image: copts.Image, |
| 523 | 523 |
Volumes: copts.flVolumes.GetMap(), |
| 524 |
- MacAddress: *copts.flMacAddress, |
|
| 524 |
+ MacAddress: copts.flMacAddress, |
|
| 525 | 525 |
Entrypoint: entrypoint, |
| 526 |
- WorkingDir: *copts.flWorkingDir, |
|
| 526 |
+ WorkingDir: copts.flWorkingDir, |
|
| 527 | 527 |
Labels: ConvertKVStringsToMap(labels), |
| 528 | 528 |
Healthcheck: healthConfig, |
| 529 | 529 |
} |
| 530 | 530 |
if flags.Changed("stop-signal") {
|
| 531 |
- config.StopSignal = *copts.flStopSignal |
|
| 531 |
+ config.StopSignal = copts.flStopSignal |
|
| 532 | 532 |
} |
| 533 | 533 |
|
| 534 | 534 |
hostConfig := &container.HostConfig{
|
| 535 | 535 |
Binds: binds, |
| 536 |
- ContainerIDFile: *copts.flContainerIDFile, |
|
| 537 |
- OomScoreAdj: *copts.flOomScoreAdj, |
|
| 538 |
- Privileged: *copts.flPrivileged, |
|
| 536 |
+ ContainerIDFile: copts.flContainerIDFile, |
|
| 537 |
+ OomScoreAdj: copts.flOomScoreAdj, |
|
| 538 |
+ Privileged: copts.flPrivileged, |
|
| 539 | 539 |
PortBindings: portBindings, |
| 540 | 540 |
Links: copts.flLinks.GetAll(), |
| 541 |
- PublishAllPorts: *copts.flPublishAll, |
|
| 541 |
+ PublishAllPorts: copts.flPublishAll, |
|
| 542 | 542 |
// Make sure the dns fields are never nil. |
| 543 | 543 |
// New containers don't ever have those fields nil, |
| 544 | 544 |
// but pre created containers can still have those nil values. |
| ... | ... |
@@ -549,7 +564,7 @@ func Parse(flags *pflag.FlagSet, copts *ContainerOptions) (*container.Config, *c |
| 549 | 549 |
DNSOptions: copts.flDNSOptions.GetAllOrEmpty(), |
| 550 | 550 |
ExtraHosts: copts.flExtraHosts.GetAll(), |
| 551 | 551 |
VolumesFrom: copts.flVolumesFrom.GetAll(), |
| 552 |
- NetworkMode: container.NetworkMode(*copts.flNetMode), |
|
| 552 |
+ NetworkMode: container.NetworkMode(copts.flNetMode), |
|
| 553 | 553 |
IpcMode: ipcMode, |
| 554 | 554 |
PidMode: pidMode, |
| 555 | 555 |
UTSMode: utsMode, |
| ... | ... |
@@ -560,15 +575,15 @@ func Parse(flags *pflag.FlagSet, copts *ContainerOptions) (*container.Config, *c |
| 560 | 560 |
RestartPolicy: restartPolicy, |
| 561 | 561 |
SecurityOpt: securityOpts, |
| 562 | 562 |
StorageOpt: storageOpts, |
| 563 |
- ReadonlyRootfs: *copts.flReadonlyRootfs, |
|
| 564 |
- LogConfig: container.LogConfig{Type: *copts.flLoggingDriver, Config: loggingOpts},
|
|
| 565 |
- VolumeDriver: *copts.flVolumeDriver, |
|
| 566 |
- Isolation: container.Isolation(*copts.flIsolation), |
|
| 563 |
+ ReadonlyRootfs: copts.flReadonlyRootfs, |
|
| 564 |
+ LogConfig: container.LogConfig{Type: copts.flLoggingDriver, Config: loggingOpts},
|
|
| 565 |
+ VolumeDriver: copts.flVolumeDriver, |
|
| 566 |
+ Isolation: container.Isolation(copts.flIsolation), |
|
| 567 | 567 |
ShmSize: shmSize, |
| 568 | 568 |
Resources: resources, |
| 569 | 569 |
Tmpfs: tmpfs, |
| 570 | 570 |
Sysctls: copts.flSysctls.GetAll(), |
| 571 |
- Runtime: *copts.flRuntime, |
|
| 571 |
+ Runtime: copts.flRuntime, |
|
| 572 | 572 |
} |
| 573 | 573 |
|
| 574 | 574 |
// When allocating stdin in attached mode, close stdin at client disconnect |
| ... | ... |
@@ -580,13 +595,13 @@ func Parse(flags *pflag.FlagSet, copts *ContainerOptions) (*container.Config, *c |
| 580 | 580 |
EndpointsConfig: make(map[string]*networktypes.EndpointSettings), |
| 581 | 581 |
} |
| 582 | 582 |
|
| 583 |
- if *copts.flIPv4Address != "" || *copts.flIPv6Address != "" || copts.flLinkLocalIPs.Len() > 0 {
|
|
| 583 |
+ if copts.flIPv4Address != "" || copts.flIPv6Address != "" || copts.flLinkLocalIPs.Len() > 0 {
|
|
| 584 | 584 |
epConfig := &networktypes.EndpointSettings{}
|
| 585 | 585 |
networkingConfig.EndpointsConfig[string(hostConfig.NetworkMode)] = epConfig |
| 586 | 586 |
|
| 587 | 587 |
epConfig.IPAMConfig = &networktypes.EndpointIPAMConfig{
|
| 588 |
- IPv4Address: *copts.flIPv4Address, |
|
| 589 |
- IPv6Address: *copts.flIPv6Address, |
|
| 588 |
+ IPv4Address: copts.flIPv4Address, |
|
| 589 |
+ IPv6Address: copts.flIPv6Address, |
|
| 590 | 590 |
} |
| 591 | 591 |
|
| 592 | 592 |
if copts.flLinkLocalIPs.Len() > 0 {
|