Browse code

add to docs that ports do not get exposed when using --net

Signed-off-by: paetling <paetling@gmail.com>

paetling authored on 2015/07/13 22:46:39
Showing 1 changed files
... ...
@@ -43,7 +43,7 @@ settings affect:
43 43
  * network settings
44 44
  * runtime constraints on CPU and memory
45 45
  * privileges and LXC configuration
46
- 
46
+
47 47
 An image developer may set defaults for these same settings when they create the
48 48
 image using the `docker build` command. Operators, however, can override all
49 49
 defaults set by the developer using the `run` options.  And, operators can also
... ...
@@ -209,12 +209,12 @@ more advanced use case would be changing the host's hostname from a container.
209 209
 
210 210
 By default, all containers have the IPC namespace enabled.
211 211
 
212
-IPC (POSIX/SysV IPC) namespace provides separation of named shared memory 
212
+IPC (POSIX/SysV IPC) namespace provides separation of named shared memory
213 213
 segments, semaphores and message queues.
214 214
 
215 215
 Shared memory segments are used to accelerate inter-process communication at
216 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, 
217
+memory is commonly used by databases and custom-built (typically C/OpenMPI,
218 218
 C++/using boost libraries) high performance applications for scientific
219 219
 computing and financial services industries. If these types of applications
220 220
 are broken into multiple containers, you might need to share the IPC mechanisms
... ...
@@ -237,6 +237,9 @@ with `docker run --net none` which disables all incoming and outgoing
237 237
 networking. In cases like this, you would perform I/O through files or
238 238
 `STDIN` and `STDOUT` only.
239 239
 
240
+Publishing ports and linking to other containers will not work
241
+when `--net` is anything other than the default (bridge).
242
+
240 243
 Your container will use the same DNS servers as the host by default, but
241 244
 you can override this with `--dns`.
242 245
 
... ...
@@ -305,9 +308,8 @@ traffic will be routed though this bridge to the container.
305 305
 With the networking mode set to `host` a container will share the host's
306 306
 network stack and all interfaces from the host will be available to the
307 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.
308
+system.  Note that `--add-host` `--hostname`  `--dns` `--dns-search` and
309
+`--mac-address` is invalid in `host` netmode.
311 310
 
312 311
 Compared to the default `bridge` mode, the `host` mode gives *significantly*
313 312
 better networking performance since it uses the host's native networking stack
... ...
@@ -323,8 +325,8 @@ or a High Performance Web Server.
323 323
 
324 324
 With the networking mode set to `container` a container will share the
325 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 
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 328
 in `container` netmode, and `--publish` `--publish-all` `--expose` are also
329 329
 invalid in `container` netmode.
330 330
 
... ...
@@ -340,7 +342,7 @@ running the `redis-cli` command and connecting to the Redis server over the
340 340
 
341 341
 Your container will have lines in `/etc/hosts` which define the hostname of the
342 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`.  
343
+`--add-host` flag can be used to add additional lines to `/etc/hosts`.
344 344
 
345 345
     $ docker run -it --add-host db-static:86.75.30.9 ubuntu cat /etc/hosts
346 346
     172.17.0.22     09d03f76bf2c
... ...
@@ -375,7 +377,7 @@ Docker supports the following restart policies:
375 375
     <tr>
376 376
       <td><strong>no</strong></td>
377 377
       <td>
378
-        Do not automatically restart the container when it exits. This is the 
378
+        Do not automatically restart the container when it exits. This is the
379 379
         default.
380 380
       </td>
381 381
     </tr>
... ...
@@ -387,7 +389,7 @@ Docker supports the following restart policies:
387 387
       </td>
388 388
       <td>
389 389
         Restart only if the container exits with a non-zero exit status.
390
-        Optionally, limit the number of restart retries the Docker 
390
+        Optionally, limit the number of restart retries the Docker
391 391
         daemon attempts.
392 392
       </td>
393 393
     </tr>
... ...
@@ -426,7 +428,7 @@ Or, to get the last time the container was (re)started;
426 426
     $ docker inspect -f "{{ .State.StartedAt }}" my-container
427 427
     # 2015-03-04T23:47:07.691840179Z
428 428
 
429
-You cannot set any restart policy in combination with 
429
+You cannot set any restart policy in combination with
430 430
 ["clean up (--rm)"](#clean-up-rm). Setting both `--restart` and `--rm`
431 431
 results in an error.
432 432
 
... ...
@@ -439,7 +441,7 @@ so that if the container exits, Docker will restart it.
439 439
 
440 440
     $ docker run --restart=on-failure:10 redis
441 441
 
442
-This will run the `redis` container with a restart policy of **on-failure** 
442
+This will run the `redis` container with a restart policy of **on-failure**
443 443
 and a maximum restart count of 10.  If the `redis` container exits with a
444 444
 non-zero exit status more than 10 times in a row Docker will abort trying to
445 445
 restart the container. Providing a maximum restart limit is only valid for the
... ...
@@ -463,7 +465,7 @@ the container exits**, you can add the `--rm` flag:
463 463
     --security-opt="label:type:TYPE"   : Set the label type for the container
464 464
     --security-opt="label:level:LEVEL" : Set the label level for the container
465 465
     --security-opt="label:disable"     : Turn off label confinement for the container
466
-    --security-opt="apparmor:PROFILE"  : Set the apparmor profile to be applied 
466
+    --security-opt="apparmor:PROFILE"  : Set the apparmor profile to be applied
467 467
                                          to the container
468 468
 
469 469
 You can override the default labeling scheme for each container by specifying
... ...
@@ -664,7 +666,7 @@ division of CPU shares:
664 664
 ### CPU period constraint
665 665
 
666 666
 The default CPU CFS (Completely Fair Scheduler) period is 100ms. We can use
667
-`--cpu-period` to set the period of CPUs to limit the container's CPU usage. 
667
+`--cpu-period` to set the period of CPUs to limit the container's CPU usage.
668 668
 And usually `--cpu-period` should work with `--cpu-quota`.
669 669
 
670 670
 Examples:
... ...
@@ -978,9 +980,9 @@ or override the Dockerfile's exposed defaults:
978 978
     --expose=[]: Expose a port or a range of ports from the container
979 979
                 without publishing it to your host
980 980
     -P=false   : Publish all exposed ports to the host interfaces
981
-    -p=[]      : Publish a container᾿s port or a range of ports to the host 
981
+    -p=[]      : Publish a container᾿s port or a range of ports to the host
982 982
                    format: ip:hostPort:containerPort | ip::containerPort | hostPort:containerPort | containerPort
983
-                   Both hostPort and containerPort can be specified as a range of ports. 
983
+                   Both hostPort and containerPort can be specified as a range of ports.
984 984
                    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`)
985 985
                    (use 'docker port' to see the actual mapping)
986 986
     --link=""  : Add link to another container (<name or id>:alias or <name or id>)
... ...
@@ -1028,13 +1030,13 @@ variables automatically:
1028 1028
  </tr>
1029 1029
  <tr>
1030 1030
   <td><code>HOSTNAME</code></td>
1031
-  <td> 
1031
+  <td>
1032 1032
     The hostname associated with the container
1033 1033
   </td>
1034 1034
  </tr>
1035 1035
  <tr>
1036 1036
   <td><code>PATH</code></td>
1037
-  <td> 
1037
+  <td>
1038 1038
     Includes popular directories, such as :<br>
1039 1039
     <code>/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin</code>
1040 1040
   </td>
... ...
@@ -1049,8 +1051,8 @@ as a result of the container being linked with another container. See
1049 1049
 the [*Container Links*](/userguide/dockerlinks/#container-linking)
1050 1050
 section for more details.
1051 1051
 
1052
-Additionally, the operator can **set any environment variable** in the 
1053
-container by using one or more `-e` flags, even overriding those mentioned 
1052
+Additionally, the operator can **set any environment variable** in the
1053
+container by using one or more `-e` flags, even overriding those mentioned
1054 1054
 above, or already defined by the developer with a Dockerfile `ENV`:
1055 1055
 
1056 1056
     $ docker run -e "deep=purple" --rm ubuntu /bin/bash -c export
... ...
@@ -1132,7 +1134,7 @@ container's `/etc/hosts` entry will be automatically updated.
1132 1132
     --volumes-from="": Mount all volumes from the given container(s)
1133 1133
 
1134 1134
 The volumes commands are complex enough to have their own documentation
1135
-in section [*Managing data in 
1135
+in section [*Managing data in
1136 1136
 containers*](/userguide/dockervolumes). A developer can define
1137 1137
 one or more `VOLUME`'s associated with an image, but only the operator
1138 1138
 can give access from one container to another (or from a container to a