Skip to content

daemon/config: fix default-network-opts in daemon.json#45264

Merged
thaJeztah merged 1 commit intomoby:masterfrom
corhere:fix-default-network-opts-config
Apr 4, 2023
Merged

daemon/config: fix default-network-opts in daemon.json#45264
thaJeztah merged 1 commit intomoby:masterfrom
corhere:fix-default-network-opts-config

Conversation

@corhere
Copy link
Copy Markdown
Contributor

@corhere corhere commented Apr 3, 2023

Thank you @richardg867 for reporting the issue.

- What I did
Prevent the daemon from erroring out if daemon.json contains default network options for network drivers aside from bridge. Configuring defaults for the bridge driver previously worked by coincidence because the unrelated CLI flag ‑‑bridge exists.

- How I did it
Added "default-network-opts" to the flatOptions set.

- How to verify it
With the following configuration, the daemon starts up and newly created overlay networks have the mtu option applied by default.

$ cat /etc/docker/daemon.json
{"default-network-opts": {"overlay": {"com.docker.network.driver.mtu": "1434"}}}

- Description for the changelog

N/A; bugfix for unreleased feature

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

@corhere corhere added status/2-code-review area/daemon Core Engine kind/bugfix PR's that fix bugs labels Apr 3, 2023
@corhere corhere added this to the 24.0.0 milestone Apr 3, 2023
@corhere corhere requested a review from thaJeztah April 3, 2023 19:46
@thaJeztah
Copy link
Copy Markdown
Member

do we have a test somewhere where we could add this to?

Copy link
Copy Markdown
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.

(fix itself LGTM)

Prevent the daemon from erroring out if daemon.json contains default
network options for network drivers aside from bridge. Configuring
defaults for the bridge driver previously worked by coincidence because
the unrelated CLI flag '--bridge' exists.

Signed-off-by: Cory Snider <[email protected]>
@corhere corhere force-pushed the fix-default-network-opts-config branch from cb92059 to 750218c Compare April 3, 2023 20:00
@corhere
Copy link
Copy Markdown
Contributor Author

corhere commented Apr 3, 2023

Good call @thaJeztah; I've added a regression test.

Copy link
Copy Markdown
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!

@thaJeztah
Copy link
Copy Markdown
Member

@rumpl @vvoland ptal

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

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

User-specified network driver option defaults

3 participants