Skip to content

Conversation

@pn11
Copy link
Contributor

@pn11 pn11 commented Feb 26, 2021

- What I did

Fixed a wrong bridge driver option for docker network create.

- How I did it

Fixed documentation.

- How to verify it

With the option in current documentation, the name of the interface in a container remains unchanged (eth0).

$ docker network create -d bridge --opt com.docker.network.container_interface_prefix=moby my-bridge
a6de36dff4b47db04bfd0ce72115d6a071401f82be653cfdd2ee4b805ba2c22a

$ docker run -it --network=my-bridge alpine ip link show
1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN qlen 1000
    link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
257425: eth0@if257426: <BROADCAST,MULTICAST,UP,LOWER_UP,M-DOWN> mtu 1500 qdisc noqueue state UP
    link/ether 02:42:c0:a8:30:02 brd ff:ff:ff:ff:ff:ff

With com.docker.network.container_iface_prefix, it works perfectly.

$ docker network create -d bridge --opt com.docker.network.container_iface_prefix=moby my-bridge
ca7448ba52d293a34ca1a1336c54f654c9cd5d5abe17b3d86c0de2f71291440f

$ docker run -it --network=my-bridge alpine ip link show
1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN qlen 1000
    link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
257428: moby0@if257429: <BROADCAST,MULTICAST,UP,LOWER_UP,M-DOWN> mtu 1500 qdisc noqueue state UP
    link/ether 02:42:c0:a8:40:02 brd ff:ff:ff:ff:ff:ff

- Description for the changelog

N/A

- A picture of a cute animal (not mandatory but encouraged)

This is Pui Pui Molcar, a stop-motion anime featuring Molmots, booming in Japan. (@molcar_anime)

EsDKv6VVkAIPNqO

@pn11 pn11 requested a review from thaJeztah as a code owner February 26, 2021 15:21
Signed-off-by: OKA Naoya <git@okanaoya.com>
Copy link
Member

@thaJeztah thaJeztah left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, thanks!

| `com.docker.network.bridge.host_binding_ipv4` | `--ip` | Default IP when binding container ports |
| `com.docker.network.driver.mtu` | `--mtu` | Set the containers network MTU |
| `com.docker.network.container_interface_prefix` | - | Set a custom prefix for container interfaces |
| `com.docker.network.container_iface_prefix` | - | Set a custom prefix for container interfaces |
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hmmm.. good catch; looks indeed the correct name; https://github.com/moby/moby/blob/a8a769f04f7ae44117772943ef0f4607b54e05ff/vendor/github.com/docker/libnetwork/netlabel/labels.go#L54-L55

// ContainerIfacePrefix can be used to override the interface prefix used inside the container
ContainerIfacePrefix = Prefix + ".container_iface_prefix"

Looks like moby/moby#31811 updated the changelog incorrectly, probably because the title of the libnetwork pull request had the wrong name in it (I just fixed that); moby/libnetwork#1667

@thaJeztah
Copy link
Member

thaJeztah commented May 31, 2021

opened moby/moby#42446 and docker/docs#12921 to fix the changelog entry

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants