Add --ip flag to container create and run - #41374
Merged
beena352 merged 2 commits intoAug 19, 2026
Merged
Conversation
Contributor
There was a problem hiding this comment.
Pull request overview
Adds --ip support to wslc container create and wslc container run, enabling callers to request a static IPv4 address for a container’s primary network endpoint and plumbing that value through the existing launcher/service wiring.
Changes:
- Registers
ArgType::IpAddressforcontainer create/container runand maps it intoContainerOptions. - Adds service-layer validation for
--ip(requires exactly one user-defined network) and passes the IP intoWSLCContainerLauncherprimary-endpoint settings. - Adds/extends unit + E2E coverage for success and rejection cases, plus new localized user-facing error messages.
Reviewed changes
Copilot reviewed 11 out of 11 changed files in this pull request and generated 1 comment.
Show a summary per file
| File | Description |
|---|---|
test/windows/WSLCTests.cpp |
Adds launcher-level tests for IP + alias round-tripping and service-layer rejection in unsupported network modes. |
test/windows/wslc/e2e/WSLCE2EContainerRunTests.cpp |
Adds E2E coverage for container run --ip success and validation failures. |
test/windows/wslc/e2e/WSLCE2EContainerCreateTests.cpp |
Adds E2E coverage for container create --ip success and validation failures. |
src/windows/wslc/tasks/ContainerTasks.cpp |
Parses --ip into ContainerOptions::IpAddress. |
src/windows/wslc/services/ContainerService.cpp |
Validates --ip vs. network selection and forwards to the launcher. |
src/windows/wslc/services/ContainerModel.h |
Adds ContainerOptions::IpAddress (currently contains unresolved merge conflict markers). |
src/windows/wslc/commands/ContainerRunCommand.cpp |
Registers --ip for container run. |
src/windows/wslc/commands/ContainerCreateCommand.cpp |
Registers --ip for container create. |
src/windows/common/WSLCContainerLauncher.h |
Adds SetPrimaryNetworkIpAddress API + member storage. |
src/windows/common/WSLCContainerLauncher.cpp |
Adds primary-endpoint KVP "IPAddress" emission when configured. |
localization/strings/en-US/Resources.resw |
Adds localized error messages for --ip network validation. |
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
Contributor
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 11 out of 11 changed files in this pull request and generated no new comments.
Suppressed comments (1)
src/windows/common/WSLCContainerLauncher.h:70
- SetPrimaryNetworkIpAddress takes a
std::string&&, which forces callers that already hold a string (e.g.ContainerService.cppusesoptions.IpAddress, and tests often haveconst std::string) to allocate/copy into a temporary just to satisfy the signature. Consider changing this to acceptstd::string_vieworconst std::string&(and copy internally), or takestd::stringby value and move into the optional, to avoid extra copies and make the API easier to call.
void AddAdditionalNetwork(const std::string& Name, const std::vector<std::string>& Aliases);
void AddPrimaryNetworkAlias(const std::string& Alias);
void SetPrimaryNetworkIpAddress(std::string&& Address);
beena352
marked this pull request as ready for review
August 18, 2026 22:15
Blue (OneBlue)
approved these changes
Aug 19, 2026
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 --ip support to wslc container create and wslc container run, allowing users to assign a static IPv4 address to a container's primary network endpoint. This mirrors the existing --network-alias plumbing, the backend was already wired; this PR adds the CLI argument, validation, and launcher integration.
PR Checklist
Detailed Description of the Pull Request / Additional comments
Validation Steps Performed