Commit 1b335de
committed
feat(docker): improve container network mode handling
This commit enhances the handling of Docker's `container:` network mode by ensuring compatibility with shared network namespaces:
- **Adding `IsContainerNetworkMode` method:** A new boolean method to easily check if the network mode is `container:<name>`
- **Conditional hostname/domainname setting:** When `container:` network mode is detected, hostname and domainname are not explicitly set, preventing Docker API errors since these settings are inherited from the target container
- **Conditional DNS setting:** DNS settings are only applied if not in `container:` network mode, as they are inherited in this configuration
- **Conditional port configuration:** `ExposedPorts` and `PortBindings` are only configured when not in `container:` network mode, since port exposure should be handled on the target container
- **ForceOutgoingIP warning:** A warning is logged if `ForceOutgoingIP` is enabled while in `container:` network mode, as this setting is incompatible and will be ignored
These changes ensure robust and correct behavior when using shared network namespaces with Docker containers, preventing API errors and configuration conflicts.1 parent 29935d6 commit 1b335de
File tree
4 files changed
+109
-10
lines changed- config
- environment/docker
- server
4 files changed
+109
-10
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
3 | 3 | | |
4 | 4 | | |
5 | 5 | | |
| 6 | + | |
6 | 7 | | |
7 | 8 | | |
8 | 9 | | |
| |||
42 | 43 | | |
43 | 44 | | |
44 | 45 | | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
| 49 | + | |
| 50 | + | |
| 51 | + | |
| 52 | + | |
45 | 53 | | |
46 | 54 | | |
47 | 55 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
17 | 17 | | |
18 | 18 | | |
19 | 19 | | |
| 20 | + | |
20 | 21 | | |
21 | 22 | | |
22 | 23 | | |
| |||
177 | 178 | | |
178 | 179 | | |
179 | 180 | | |
| 181 | + | |
| 182 | + | |
| 183 | + | |
| 184 | + | |
| 185 | + | |
| 186 | + | |
| 187 | + | |
| 188 | + | |
| 189 | + | |
| 190 | + | |
| 191 | + | |
| 192 | + | |
| 193 | + | |
| 194 | + | |
| 195 | + | |
| 196 | + | |
| 197 | + | |
| 198 | + | |
| 199 | + | |
180 | 200 | | |
181 | | - | |
182 | | - | |
| 201 | + | |
| 202 | + | |
183 | 203 | | |
184 | 204 | | |
185 | 205 | | |
186 | 206 | | |
187 | 207 | | |
188 | | - | |
| 208 | + | |
189 | 209 | | |
190 | 210 | | |
191 | 211 | | |
| |||
199 | 219 | | |
200 | 220 | | |
201 | 221 | | |
| 222 | + | |
| 223 | + | |
| 224 | + | |
202 | 225 | | |
203 | | - | |
204 | | - | |
| 226 | + | |
| 227 | + | |
| 228 | + | |
| 229 | + | |
205 | 230 | | |
206 | 231 | | |
207 | 232 | | |
| |||
233 | 258 | | |
234 | 259 | | |
235 | 260 | | |
| 261 | + | |
| 262 | + | |
| 263 | + | |
| 264 | + | |
| 265 | + | |
| 266 | + | |
| 267 | + | |
| 268 | + | |
| 269 | + | |
| 270 | + | |
| 271 | + | |
| 272 | + | |
| 273 | + | |
| 274 | + | |
| 275 | + | |
| 276 | + | |
236 | 277 | | |
237 | | - | |
| 278 | + | |
238 | 279 | | |
239 | 280 | | |
240 | 281 | | |
| |||
250 | 291 | | |
251 | 292 | | |
252 | 293 | | |
253 | | - | |
| 294 | + | |
254 | 295 | | |
255 | 296 | | |
256 | 297 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
415 | 415 | | |
416 | 416 | | |
417 | 417 | | |
| 418 | + | |
| 419 | + | |
| 420 | + | |
| 421 | + | |
| 422 | + | |
| 423 | + | |
| 424 | + | |
| 425 | + | |
| 426 | + | |
| 427 | + | |
| 428 | + | |
| 429 | + | |
| 430 | + | |
418 | 431 | | |
419 | | - | |
| 432 | + | |
420 | 433 | | |
421 | 434 | | |
422 | 435 | | |
| |||
431 | 444 | | |
432 | 445 | | |
433 | 446 | | |
434 | | - | |
| 447 | + | |
| 448 | + | |
| 449 | + | |
| 450 | + | |
| 451 | + | |
| 452 | + | |
435 | 453 | | |
436 | 454 | | |
437 | 455 | | |
| |||
452 | 470 | | |
453 | 471 | | |
454 | 472 | | |
455 | | - | |
| 473 | + | |
456 | 474 | | |
457 | 475 | | |
458 | 476 | | |
| |||
0 commit comments