Commit a495719
committed
fix: display containers belonging to multiple networks in nerdctl network inspect
When a container belongs to multiple networks, running the nerdctl network
inspect command on the network to which the container belongs does not
display the container in the current implementation.
Specifically, it is displayed as follows.
```
$ sudo nerdctl run -d --name net --net=foo --net=bar nginx
d88e878f0c60823bd0c361bad250f27b19ad117fb3336fcf18fa26ab1910c367
$ sudo nerdctl network inspect foo | jq .[0].Containers
{}
$ sudo nerdctl network inspect bar | jq .[0].Containers
{}
```
Ideally, running the nerdctl network inspect command on the networks to
which the contaienr belongs should display the container name as follows.
```
$ sudo nerdctl network inspect foo | jq .[0].Containers
{
"d88e878f0c60823bd0c361bad250f27b19ad117fb3336fcf18fa26ab1910c367": {
"Name": "net"
}
}
$ sudo nerdctl network inspect bar | jq .[0].Containers
{
"d88e878f0c60823bd0c361bad250f27b19ad117fb3336fcf18fa26ab1910c367": {
"Name": "net"
}
}
```
Therefore, this behaviour is fixed in this PR.
Signed-off-by: Hayato Kiwata <[email protected]>1 parent 694c405 commit a495719
File tree
2 files changed
+60
-4
lines changed- cmd/nerdctl/network
- pkg/cmd/network
2 files changed
+60
-4
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
320 | 320 | | |
321 | 321 | | |
322 | 322 | | |
| 323 | + | |
| 324 | + | |
| 325 | + | |
| 326 | + | |
| 327 | + | |
| 328 | + | |
| 329 | + | |
| 330 | + | |
| 331 | + | |
| 332 | + | |
| 333 | + | |
| 334 | + | |
| 335 | + | |
| 336 | + | |
| 337 | + | |
| 338 | + | |
| 339 | + | |
| 340 | + | |
| 341 | + | |
| 342 | + | |
| 343 | + | |
| 344 | + | |
| 345 | + | |
| 346 | + | |
| 347 | + | |
| 348 | + | |
| 349 | + | |
| 350 | + | |
| 351 | + | |
| 352 | + | |
| 353 | + | |
| 354 | + | |
| 355 | + | |
323 | 356 | | |
324 | 357 | | |
325 | 358 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
21 | 21 | | |
22 | 22 | | |
23 | 23 | | |
| 24 | + | |
24 | 25 | | |
25 | 26 | | |
26 | 27 | | |
| |||
58 | 59 | | |
59 | 60 | | |
60 | 61 | | |
61 | | - | |
62 | 62 | | |
| 63 | + | |
63 | 64 | | |
64 | | - | |
65 | 65 | | |
66 | 66 | | |
67 | 67 | | |
68 | 68 | | |
69 | 69 | | |
70 | | - | |
71 | 70 | | |
72 | 71 | | |
73 | 72 | | |
| |||
76 | 75 | | |
77 | 76 | | |
78 | 77 | | |
79 | | - | |
| 78 | + | |
| 79 | + | |
| 80 | + | |
| 81 | + | |
| 82 | + | |
| 83 | + | |
| 84 | + | |
| 85 | + | |
80 | 86 | | |
81 | 87 | | |
82 | 88 | | |
| |||
113 | 119 | | |
114 | 120 | | |
115 | 121 | | |
| 122 | + | |
| 123 | + | |
| 124 | + | |
| 125 | + | |
| 126 | + | |
| 127 | + | |
| 128 | + | |
| 129 | + | |
| 130 | + | |
| 131 | + | |
| 132 | + | |
| 133 | + | |
| 134 | + | |
| 135 | + | |
| 136 | + | |
| 137 | + | |
| 138 | + | |
0 commit comments