Windows containers: report HNS network name in inspect#50961
Merged
thaJeztah merged 2 commits intomoby:masterfrom Sep 16, 2025
Merged
Windows containers: report HNS network name in inspect#50961thaJeztah merged 2 commits intomoby:masterfrom
thaJeztah merged 2 commits intomoby:masterfrom
Conversation
After creating a new network, inspect shows that there's no value for option "com.docker.network.windowsshim.networkname". After restarting the daemon, it shows up with the docker network name (not the HNS network name, which defaults to the docker network's id). Creating the network with "-o com.docker.network.windowsshim.networkname" sets the HNS network name, and it shows up in inspect. Until the daemon is restarted, then it shows the docker network name. So - set the option value to the HNS network name on creation (the id if no name is given), and on restore after restart use the name reported by HNS. Signed-off-by: Rob Murray <rob.murray@docker.com>
akerouanton
approved these changes
Sep 12, 2025
Member
I'm guessing that could be because the network is destroyed by Windows nowadays; |
Contributor
Author
Oh, duh! Thank you, I didn't look closely enough ... so there's another bug, options aren't copied into the re-created network when restoring HNS networks from Docker's store. I'll zap that too. |
When Windows reboots, it removes HNS networks. They're restored from Docker's store (unlike after a daemon restart, where Docker networks are restored from HNS networks). When that happens, preserve the driver-opt that reports the HNS network name when that happens. Signed-off-by: Rob Murray <rob.murray@docker.com>
thaJeztah
approved these changes
Sep 15, 2025
Member
thaJeztah
left a comment
There was a problem hiding this comment.
SGTM
@akerouanton PTAL (some changes after you last reviewed)
corhere
approved these changes
Sep 15, 2025
Member
|
Let me bring this one in |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
- What I did
After creating a new network, inspect shows that there's no value for option "com.docker.network.windowsshim.networkname". After restarting the daemon, it shows up with the docker network name (not the HNS network name, which defaults to the docker network's id).
Creating the network with "-o com.docker.network.windowsshim.networkname" sets the HNS network name, and it shows up in inspect. Until the daemon is restarted, then it shows the docker network name.
When Windows reboots, it deletes HNS networks. They're re-created from Docker's store, but the HNS network name is lost.
- How I did it
Set the option value to the HNS network name on creation (the id if no name is given), and on restore after restart use the name reported by HNS. On restore after reboot, preserve the HNS name recorded in Docker's driver-opts.
- How to verify it
Check
com.docker.network.windowsshim.networknamereported ininspectis as-expected for each network (Docker's network id, andn2name), and that they match the HNS names (Get-HnsNetwork -id <hns id from inspect>).Restart the daemon and check nothing changed.
Reboot and check the HNS network names are preserved, the HNS network ids will change.
- Human readable description for the release notes