Skip to content

Commit 0e96379

Browse files
authored
Update services.md
Explicitly state the dangers if a port mapping binds to all interfaces
1 parent eee4ee8 commit 0e96379

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

content/reference/compose-file/services.md

+7
Original file line numberDiff line numberDiff line change
@@ -1572,6 +1572,11 @@ in the form:
15721572
- `CONTAINER` is `port | range`.
15731573
- `PROTOCOL` restricts ports to a specified protocol either `tcp` or `udp`(optional). Default is `tcp`.
15741574

1575+
>[!CAUTION]
1576+
>
1577+
>If you do not specify an IP address (such as 127.0.0.1) and it binds to all interfaces then any machine on the same network could
1578+
>potentially have access to the container. This could be especially dangerous if the container is exposed to the internet.
1579+
15751580
Ports can be either a single value or a range. `HOST` and `CONTAINER` must use equivalent ranges.
15761581

15771582
You can either specify both ports (`HOST:CONTAINER`), or just the container port. In the latter case,
@@ -1580,6 +1585,8 @@ the container runtime automatically allocates any unassigned port of the host.
15801585
`HOST:CONTAINER` should always be specified as a (quoted) string, to avoid conflicts
15811586
with [YAML base-60 float](https://yaml.org/type/float.html).
15821587

1588+
1589+
15831590
IPv6 addresses can be enclosed in square brackets.
15841591

15851592
Examples:

0 commit comments

Comments
 (0)