Merge pull request #468 from rubensfig/34373-docker-doc

Added docker documentation for Expose
This commit is contained in:
Vincent Demeester 2017-08-25 09:07:16 +02:00 committed by GitHub
commit 1086e84718
2 changed files with 44 additions and 38 deletions

Binary file not shown.

View File

@ -416,11 +416,11 @@ temp?
This file causes the following build behavior:
| Rule | Behavior |
|----------------|------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
|:------------|:---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| `# comment` | Ignored. |
| `*/temp*` | Exclude files and directories whose names start with `temp` in any immediate subdirectory of the root. For example, the plain file `/somedir/temporary.txt` is excluded, as is the directory `/somedir/temp`. |
| `*/*/temp*` | Exclude files and directories starting with `temp` from any subdirectory that is two levels below the root. For example, `/somedir/subdir/temporary.txt` is excluded. |
| `temp?` | Exclude files and directories in the root directory whose names are a one-character extension of `temp`. For example, `/tempa` and `/tempb` are excluded.
| `temp?` | Exclude files and directories in the root directory whose names are a one-character extension of `temp`. For example, `/tempa` and `/tempb` are excluded. |
Matching is done using Go's
@ -754,20 +754,26 @@ This will then be visible from `docker inspect` with the other labels.
## EXPOSE
EXPOSE <port> [<port>...]
EXPOSE <port> [<port>/<protocol>...]
The `EXPOSE` instruction informs Docker that the container listens on the
specified network ports at runtime. `EXPOSE` does not make the ports of the
container accessible to the host. To do that, you must use either the `-p` flag
to publish a range of ports or the `-P` flag to publish all of the exposed
ports. You can expose one port number and publish it externally under another
number.
specified network ports at runtime. You can specify whether the port listens on
TCP or UDP, and the default is TCP if the protocol is not specified.
The `EXPOSE` instruction does not actually publish the port. It functions as a
type of documentation between the person who builds the image and the person who
runs the container, about which ports are intended to be published. To actually
publish the port when running the container, use the `-p` flag on `docker run`
to publish and map one or more ports, or the `-P` flag to publish all exposed
ports and map them to to high-order ports.
To set up port redirection on the host system, see [using the -P
flag](run.md#expose-incoming-ports). The Docker network feature supports
creating networks without the need to expose ports within the network, for
detailed information see the [overview of this
feature](https://docs.docker.com/engine/userguide/networking/)).
flag](run.md#expose-incoming-ports). The `docker network` command supports
creating networks for communication among containers without the need to
expose or publish specific ports, because the containers connected to the
network can communicate with each other over any port. For detailed information,
see the
[overview of this feature](https://docs.docker.com/engine/userguide/networking/)).
## ENV
@ -1250,7 +1256,7 @@ or for executing an ad-hoc command in a container.
The table below shows what command is executed for different `ENTRYPOINT` / `CMD` combinations:
| | No ENTRYPOINT | ENTRYPOINT exec_entry p1_entry | ENTRYPOINT ["exec_entry", "p1_entry"] |
|--------------------------------|----------------------------|--------------------------------|------------------------------------------------|
|:-------------------------------|:---------------------------|:-------------------------------|:-----------------------------------------------|
| **No CMD** | *error, not allowed* | /bin/sh -c exec_entry p1_entry | exec_entry p1_entry |
| **CMD ["exec_cmd", "p1_cmd"]** | exec_cmd p1_cmd | /bin/sh -c exec_entry p1_entry | exec_entry p1_entry exec_cmd p1_cmd |
| **CMD ["p1_cmd", "p2_cmd"]** | p1_cmd p2_cmd | /bin/sh -c exec_entry p1_entry | exec_entry p1_entry p1_cmd p2_cmd |