Support arbitrary network driver options in wslc network create#40859
Open
beena352 wants to merge 10 commits into
Open
Support arbitrary network driver options in wslc network create#40859beena352 wants to merge 10 commits into
beena352 wants to merge 10 commits into
Conversation
Contributor
There was a problem hiding this comment.
Pull request overview
This PR extends WSLC network management to support arbitrary Docker network driver options end-to-end (create → inspect JSON output → session recovery), while still treating a small set of reserved keys (Internal, Subnet, Gateway) as typed inputs with strict casing to avoid silent misinterpretation.
Changes:
- Allow non-reserved
DriverOptsto pass through to Docker’sCreateNetwork.Options, while rejecting case-mismatches for reserved keys. - Persist and surface network
Optionsin WSLC’s in-memory metadata and JSON schema (wslc_schema::Network), including after session recovery. - Add/adjust Windows tests to validate arbitrary options round-trip and recovery behavior.
Reviewed changes
Copilot reviewed 5 out of 5 changed files in this pull request and generated no comments.
Show a summary per file
| File | Description |
|---|---|
| test/windows/WSLCTests.cpp | Updates invalid-option expectations (case-mismatch only for reserved keys) and adds coverage for arbitrary driver options + recovery persistence. |
| src/windows/wslcsession/WSLCSession.cpp | Implements reserved-key case-mismatch validation, forwards non-reserved options to Docker, and stores/returns Options on inspect and recovery. |
| src/windows/wslcsession/WSLCNetworkMetadata.h | Extends the cached network entry to include Options. |
| src/windows/inc/wslc_schema.h | Adds optional Options to WSLC inspect-network JSON schema. |
| src/windows/inc/docker_schema.h | Adds optional Options to Docker network create/inspect schema used by the client. |
OneBlue
reviewed
Jun 22, 2026
…eenachauhan/feat/wslc-network-arbitrary-driver-opts
dkbennett
approved these changes
Jul 1, 2026
dkbennett
left a comment
Member
There was a problem hiding this comment.
LGTM, minor non-blocking comment
| Argument::Create(ArgType::Driver, std::nullopt, std::nullopt, Localization::WSLCCLI_NetworkDriverOptionDescription()), | ||
| Argument::Create(ArgType::Options, false, NO_LIMIT), | ||
| Argument::Create(ArgType::Label, false, NO_LIMIT, Localization::WSLCCLI_NetworkLabelArgDescription()), | ||
| Argument::Create(ArgType::Internal), |
Member
There was a problem hiding this comment.
nit: for non-positional / forward args prefer to keep these in alphabetical order
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.
Summary of the Pull Request
Adds typed CLI flags (--internal, --subnet, --gateway) to wslc network create, replacing the old behavior where these were passed as generic driver options. Arbitrary driver options are forwarded verbatim to Docker via --opt key=value, matching Docker's pass-through behavior.
PR Checklist
Detailed Description of the Pull Request / Additional comments
Problem: Network creation options like subnet, gateway, and internal were passed as generic driver opts, with no discoverability. Arbitrary Docker driver options were silently dropped.
Changes:
Validation Steps Performed