Commit 073aad1
feat(reach): add --extra-port for ad-hoc port publishing on create
Add `reach create --extra-port HOST:CONTAINER` (repeatable) and
`SandboxPorts.extra: Vec<(u16, u16)>` to publish additional ports
beyond the built-in vnc/novnc/health trio.
Driven by a real workflow: a host process needs to drive Chrome's
remote debugging port (CDP) inside the sandbox. Without extra-port
mapping the only options are recreating the container manually with
`docker run -p` (loses reach lifecycle management) or routing through
the docker bridge IP (blocked under WSL2 + DockerDesktop).
- Single-port shorthand `--extra-port 9222` expands to `9222:9222`.
- Each pair propagates through HostConfig.port_bindings and
ExposedPorts so docker actually publishes the mapping.
- Result `SandboxPortMapping.extra` round-trips through the JSON
serializer (skipped when empty so existing JSON consumers see no
change), and `extract_ports` recovers it from `docker ps` output.
- `reach create` summary prints any extras under an "Extra:" line.
Tests:
- existing docker_types JSON test still passes (extra defaults to
empty Vec via the new field with serde skip_serializing_if).
- value_parser unit-tested implicitly via clap on cargo build.
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>1 parent 1874977 commit 073aad1
3 files changed
Lines changed: 64 additions & 1 deletion
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
30 | 30 | | |
31 | 31 | | |
32 | 32 | | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
33 | 42 | | |
34 | 43 | | |
35 | 44 | | |
| |||
46 | 55 | | |
47 | 56 | | |
48 | 57 | | |
| 58 | + | |
| 59 | + | |
| 60 | + | |
| 61 | + | |
| 62 | + | |
| 63 | + | |
| 64 | + | |
| 65 | + | |
| 66 | + | |
| 67 | + | |
| 68 | + | |
| 69 | + | |
| 70 | + | |
| 71 | + | |
| 72 | + | |
49 | 73 | | |
50 | 74 | | |
51 | 75 | | |
| |||
68 | 92 | | |
69 | 93 | | |
70 | 94 | | |
| 95 | + | |
71 | 96 | | |
72 | 97 | | |
73 | 98 | | |
| |||
132 | 157 | | |
133 | 158 | | |
134 | 159 | | |
| 160 | + | |
| 161 | + | |
| 162 | + | |
| 163 | + | |
| 164 | + | |
| 165 | + | |
| 166 | + | |
| 167 | + | |
135 | 168 | | |
136 | 169 | | |
137 | 170 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
83 | 83 | | |
84 | 84 | | |
85 | 85 | | |
| 86 | + | |
| 87 | + | |
| 88 | + | |
| 89 | + | |
| 90 | + | |
| 91 | + | |
86 | 92 | | |
87 | 93 | | |
88 | 94 | | |
| |||
91 | 97 | | |
92 | 98 | | |
93 | 99 | | |
| 100 | + | |
94 | 101 | | |
95 | 102 | | |
96 | 103 | | |
| |||
151 | 158 | | |
152 | 159 | | |
153 | 160 | | |
| 161 | + | |
| 162 | + | |
| 163 | + | |
| 164 | + | |
154 | 165 | | |
155 | 166 | | |
156 | 167 | | |
| |||
236 | 247 | | |
237 | 248 | | |
238 | 249 | | |
| 250 | + | |
| 251 | + | |
| 252 | + | |
| 253 | + | |
| 254 | + | |
| 255 | + | |
| 256 | + | |
| 257 | + | |
| 258 | + | |
239 | 259 | | |
240 | 260 | | |
241 | 261 | | |
| |||
278 | 298 | | |
279 | 299 | | |
280 | 300 | | |
| 301 | + | |
| 302 | + | |
| 303 | + | |
281 | 304 | | |
282 | 305 | | |
283 | 306 | | |
| |||
310 | 333 | | |
311 | 334 | | |
312 | 335 | | |
| 336 | + | |
313 | 337 | | |
314 | 338 | | |
315 | 339 | | |
| |||
590 | 614 | | |
591 | 615 | | |
592 | 616 | | |
| 617 | + | |
593 | 618 | | |
594 | 619 | | |
595 | 620 | | |
596 | 621 | | |
597 | 622 | | |
598 | 623 | | |
599 | 624 | | |
600 | | - | |
| 625 | + | |
| 626 | + | |
| 627 | + | |
| 628 | + | |
| 629 | + | |
601 | 630 | | |
602 | 631 | | |
603 | 632 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
124 | 124 | | |
125 | 125 | | |
126 | 126 | | |
| 127 | + | |
127 | 128 | | |
128 | 129 | | |
129 | 130 | | |
| |||
0 commit comments