Skip to content

Commit a8ffee2

Browse files
committed
Explain bridge option host_binding_ipv4
Signed-off-by: Rob Murray <[email protected]>
1 parent 0246b73 commit a8ffee2

File tree

1 file changed

+21
-0
lines changed

1 file changed

+21
-0
lines changed

content/network/drivers/bridge.md

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -134,6 +134,27 @@ your own `docker0` bridge. Use this option if you want to run multiple daemon
134134
instances on the same host. For details, see
135135
[Run multiple daemons](../../reference/cli/dockerd.md#run-multiple-daemons).
136136

137+
### Default host binding address
138+
139+
When no host address is given in port publishing options like `-p 80`
140+
or `-p 8080:80`, the default is to make the container's port 80 available on all
141+
host addresses, IPv4 and IPv6.
142+
143+
Option `com.docker.network.bridge.host_binding_ipv4` can be used to modify the
144+
default address for published ports.
145+
146+
Despite the option's name, it is possible to specify an IPv6 address.
147+
148+
When the default binding address is an address assigned to a specific interface,
149+
the container's port will only be accessible via that address.
150+
151+
Setting the default binding address to `::` means published ports will only be
152+
available on the host's IPv6 addresses. However, setting it to `0.0.0.0` means it
153+
will be available on the host's IPv4 and IPv6 addresses.
154+
155+
To restrict a published port to IPv4 only, the address must be included in the
156+
container's publishing options. For example, `-p 0.0.0.0:8080:80`.
157+
137158
## Manage a user-defined bridge
138159

139160
Use the `docker network create` command to create a user-defined bridge

0 commit comments

Comments
 (0)