Skip to content

Commit

Permalink
Explain bridge option host_binding_ipv4
Browse files Browse the repository at this point in the history
Signed-off-by: Rob Murray <[email protected]>
  • Loading branch information
robmry committed Jun 14, 2024
1 parent 3a5deec commit 5ff6e0b
Showing 1 changed file with 21 additions and 0 deletions.
21 changes: 21 additions & 0 deletions content/network/drivers/bridge.md
Original file line number Diff line number Diff line change
Expand Up @@ -134,6 +134,27 @@ your own `docker0` bridge. Use this option if you want to run multiple daemon
instances on the same host. For details, see
[Run multiple daemons](../../reference/cli/dockerd.md#run-multiple-daemons).

### Default host binding address

When no host address is given in port publishing options like `-p 80`
or `-p 8080:80`, the default is to make the container's port 80 available on all
host addresses, IPv4 and IPv6.

The bridge network driver option `com.docker.network.bridge.host_binding_ipv4`
can be used to modify the default address for published ports.

Despite the option's name, it is possible to specify an IPv6 address.

When the default binding address is an address assigned to a specific interface,
the container's port will only be accessible via that address.

Setting the default binding address to `::` means published ports will only be
available on the host's IPv6 addresses. However, setting it to `0.0.0.0` means it
will be available on the host's IPv4 and IPv6 addresses.

To restrict a published port to IPv4 only, the address must be included in the
container's publishing options. For example, `-p 0.0.0.0:8080:80`.

## Manage a user-defined bridge

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

0 comments on commit 5ff6e0b

Please sign in to comment.