Show the 3-part port syntax more clearly

The 3-part (IP:HOSTPORT:CONTAINERPORT) syntax in `ports` has been there a long time, but isn't adequately described here.
This commit is contained in:
Randy Fay 2021-02-13 06:08:43 -07:00 committed by GitHub
parent 8cee7762d1
commit 5b2b270b3b
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 5 additions and 2 deletions

View File

@ -1641,8 +1641,10 @@ Expose ports.
#### Short syntax
Either specify both ports (`HOST:CONTAINER`), or just the container
port (an ephemeral host port is chosen).
There are three options:
* Specify both ports (`HOST:CONTAINER`)
* Specify just the container port (an ephemeral host port is chosen for the host port).
* Specify the host IP address to bind to AND both ports (the default is 0.0.0.0, meaning all interfaces): (`IPADDR:HOSTPORT:CONTAINERPORT`). If HOSTPORT is empty (for example `127.0.0.1::80`), an ephemeral port is chosen to bind to on the host.
> **Note**
>
@ -1660,6 +1662,7 @@ ports:
- "49100:22"
- "127.0.0.1:8001:8001"
- "127.0.0.1:5000-5010:5000-5010"
- "127.0.0.1::5000
- "6060:6060/udp"
- "12400-12500:1240"
```