Commit 2eefc83
feat(wslc): add WSL Containers (wslc://) transport, lifecycle integration and auto-detection
WSL Containers (wslc) runs dockerd inside a lightweight VM that exposes no
Windows named pipe or TCP port; the only host-visible channel is the stdio
bridge `wslc system session run docker system dial-stdio`. This adds first-class
wslc support to docker-java.
Transport (docker-java-transport, -transport-httpclient5):
- WslcSocket: a Socket whose streams are the wslc dial-stdio child process
(mirrors NamedPipeSocket; java.util.logging only, no new dependency).
- ApacheDockerHttpClientImpl: a `wslc` scheme case plus a WslcSocket branch.
Hijacked exec/attach/log streams work unchanged at the HttpClient5 socket level.
Lifecycle integration (docker-java-core):
- wslc's Windows integration (127.0.0.1 port relay and Windows-path bind mounts)
is wired by the wslc control plane only when a container is created/started
through the native `wslc` CLI, not over the Docker API on the same dockerd.
- WslcLifecycleDockerHttpClient decorates a Docker-API client and reconciles just
the affected calls with the wslc CLI, delegating everything else unchanged:
POST /containers/create -> wslc create, POST /containers/{id}/start -> wslc
start (wires relay+bind), POST /networks/create -> wslc network create, and
GET /containers/{id}/json with NetworkSettings.Ports overridden from `wslc list`
(the start relay's real host port differs from the daemon's recorded one).
- Activated transparently in DockerClientImpl.getInstance only when the host
scheme is wslc, so unix/npipe/tcp are unaffected and no extra dependency is
needed. Consumers that shade docker-java-core (e.g. Testcontainers) pick it up
after a plain rebuild.
Auto-detection (DefaultDockerClientConfig):
- when DOCKER_HOST is unset, fall back to wslc://localhost on Windows only if the
//./pipe/docker_engine pipe is absent and wslc is available (`wslc version`
exit 0, WSLC_EXECUTABLE-overridable), so Docker Desktop/Podman keep winning.
Tests run without a daemon or wslc CLI: WslcSocketTest (executable resolution and
connect failure) and WslcLifecycleDockerHttpClientTest (request pass-through,
inspect fallback when wslc is unavailable, create-failure handling).
Refs: #2658
Signed-off-by: David Tavoularis <david.tavoularis@mycom-osi.com>
Co-authored-by: Claude <noreply@anthropic.com>1 parent 002b6eb commit 2eefc83
7 files changed
Lines changed: 916 additions & 2 deletions
File tree
- docker-java-core/src/main/java/com/github/dockerjava/core
- docker-java-transport-httpclient5/src/main/java/com/github/dockerjava/httpclient5
- docker-java-transport/src/main/java/com/github/dockerjava/transport
- docker-java/src/test/java/com/github/dockerjava
- core
- transport
Lines changed: 61 additions & 1 deletion
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
28 | 28 | | |
29 | 29 | | |
30 | 30 | | |
| 31 | + | |
31 | 32 | | |
32 | 33 | | |
33 | 34 | | |
| |||
68 | 69 | | |
69 | 70 | | |
70 | 71 | | |
| 72 | + | |
| 73 | + | |
| 74 | + | |
| 75 | + | |
| 76 | + | |
71 | 77 | | |
72 | 78 | | |
73 | 79 | | |
| |||
115 | 121 | | |
116 | 122 | | |
117 | 123 | | |
| 124 | + | |
| 125 | + | |
| 126 | + | |
| 127 | + | |
| 128 | + | |
| 129 | + | |
| 130 | + | |
| 131 | + | |
| 132 | + | |
| 133 | + | |
| 134 | + | |
| 135 | + | |
| 136 | + | |
| 137 | + | |
| 138 | + | |
| 139 | + | |
| 140 | + | |
| 141 | + | |
| 142 | + | |
| 143 | + | |
| 144 | + | |
| 145 | + | |
| 146 | + | |
| 147 | + | |
| 148 | + | |
| 149 | + | |
| 150 | + | |
| 151 | + | |
| 152 | + | |
| 153 | + | |
| 154 | + | |
| 155 | + | |
| 156 | + | |
| 157 | + | |
| 158 | + | |
| 159 | + | |
| 160 | + | |
| 161 | + | |
| 162 | + | |
| 163 | + | |
| 164 | + | |
| 165 | + | |
| 166 | + | |
| 167 | + | |
| 168 | + | |
| 169 | + | |
| 170 | + | |
| 171 | + | |
| 172 | + | |
| 173 | + | |
| 174 | + | |
| 175 | + | |
| 176 | + | |
| 177 | + | |
118 | 178 | | |
119 | 179 | | |
120 | 180 | | |
| |||
485 | 545 | | |
486 | 546 | | |
487 | 547 | | |
488 | | - | |
| 548 | + | |
489 | 549 | | |
490 | 550 | | |
491 | 551 | | |
| |||
Lines changed: 12 additions & 1 deletion
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
211 | 211 | | |
212 | 212 | | |
213 | 213 | | |
| 214 | + | |
| 215 | + | |
| 216 | + | |
| 217 | + | |
| 218 | + | |
| 219 | + | |
| 220 | + | |
| 221 | + | |
| 222 | + | |
| 223 | + | |
| 224 | + | |
214 | 225 | | |
215 | | - | |
| 226 | + | |
216 | 227 | | |
217 | 228 | | |
218 | 229 | | |
| |||
0 commit comments