Support attaching and detaching containers to networks after creation#40549
Open
beena352 wants to merge 3 commits into
Open
Support attaching and detaching containers to networks after creation#40549beena352 wants to merge 3 commits into
beena352 wants to merge 3 commits into
Conversation
OneBlue
reviewed
May 15, 2026
…eenachauhan/wslc-attach-detach-network # Conflicts: # test/windows/WSLCTests.cpp
Contributor
There was a problem hiding this comment.
Pull request overview
This PR adds WSLC APIs intended to attach and detach already-created containers from WSLC-managed Docker networks, plus tests for the new attach/detach behavior.
Changes:
- Adds session-level
AttachContainerToNetworkandDetachContainerFromNetworkdeclarations and implementations. - Adds Docker HTTP client helpers and request schema types for network connect/disconnect endpoints.
- Adds WSLC tests covering round-trip attach/detach and several validation paths.
Reviewed changes
Copilot reviewed 8 out of 8 changed files in this pull request and generated 3 comments.
Show a summary per file
| File | Description |
|---|---|
src/windows/service/inc/wslc.idl |
Adds new network attach/detach methods to IWSLCSession. |
src/windows/wslcsession/WSLCSession.h |
Declares the new session methods. |
src/windows/wslcsession/WSLCSession.cpp |
Implements validation, lookup, Docker connect/disconnect calls, and logging. |
src/windows/wslcsession/WSLCContainer.h |
Exposes container network mode to session logic. |
src/windows/wslcsession/DockerHTTPClient.h |
Declares Docker network connect/disconnect helpers. |
src/windows/wslcsession/DockerHTTPClient.cpp |
Implements Docker network connect/disconnect endpoint calls. |
src/windows/inc/docker_schema.h |
Adds request payload schemas for Docker network connect/disconnect. |
test/windows/WSLCTests.cpp |
Adds tests for attach/detach network behavior and validation. |
Comments suppressed due to low confidence (4)
test/windows/WSLCTests.cpp:6293
- This call targets
IWSLCContainer::AttachToNetwork, but that method is not declared onIWSLCContainer; the added API isIWSLCSession::AttachContainerToNetwork. Update the test to call through the session with the launched container's ID.
VERIFY_ARE_EQUAL(E_INVALIDARG, container.Get().AttachToNetwork(&attachment));
test/windows/WSLCTests.cpp:6321
- This call will not compile because
AttachToNetworkis not part ofIWSLCContainer; the new attach method is onIWSLCSession. Use the session-level API with this container's ID.
VERIFY_ARE_EQUAL(E_INVALIDARG, container.Get().AttachToNetwork(&attachment));
test/windows/WSLCTests.cpp:6332
- This call will not compile because
AttachToNetworkis not declared onIWSLCContainer; call the session-level attach API with the container ID instead.
VERIFY_ARE_EQUAL(E_INVALIDARG, container.Get().AttachToNetwork(&attachment));
test/windows/WSLCTests.cpp:6347
- This call targets a non-existent
IWSLCContainer::AttachToNetworkmethod. The attach API added in this PR is session-level, so the test should useAttachContainerToNetworkon the session with the container ID.
VERIFY_ARE_EQUAL(E_NOTIMPL, container.Get().AttachToNetwork(&attachment));
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
Implements AttachContainerToNetwork and DetachContainerFromNetwork methods on IWSLCSession, enabling containers to join/leave networks after they are created and running.
PR Checklist
Detailed Description of the Pull Request / Additional comments
Validation Steps Performed