Skip to content

Conversation

@coderbirju
Copy link
Contributor

@coderbirju coderbirju commented Jan 7, 2026

Current network inspect respone provides only container names
This PR adds other fields in the EndpointResource Struct

Testing:

CIDR Notation:

$ sudo nerdctl network create test-net --subnet 10.88.0.0/16
$ sudo nerdctl run -d --name test-container --network test-net nginx:alpine
$ sudo nerdctl network inspect test-net | jq -r '.[].Containers'

Result

{
  "70aaec372b1f...": {
    "Name": "test-container",
    "MacAddress": "fe:5d:85:64:d2:96",
    "IPv4Address": "10.88.0.2/16", 
    "IPv6Address": ""
  }
}

Multi-Network Container:

$ sudo nerdctl network create hoge --subnet 10.91.0.0/16
$ sudo nerdctl network create fuga --subnet 10.92.0.0/16
$ sudo nerdctl run -d --name test2 --network hoge --network fuga nginx:alpine

-hoge

$ sudo nerdctl network inspect hoge | jq -r '.[].Containers'

{
  "0d7e17a42d25...": {
    "Name": "test2",
    "MacAddress": "ca:ad:6d:42:7a:03",  ← Unique to hoge
    "IPv4Address": "10.91.0.3/16",      ← From hoge subnet
    "IPv6Address": ""
  }
}

-fuga

$ sudo nerdctl network inspect fuga | jq -r '.[].Containers'


{
  "0d7e17a42d25...": {
    "Name": "test2",
    "MacAddress": "ca:f2:87:2c:4e:df",  ← Different MAC
    "IPv4Address": "10.92.0.2/16",      ← Different IP from fuga subnet
    "IPv6Address": ""
  }
}

@coderbirju coderbirju closed this Jan 7, 2026
@coderbirju coderbirju reopened this Jan 7, 2026
@coderbirju coderbirju force-pushed the add-details-network-inspect branch from 2385db1 to eb356cf Compare January 9, 2026 00:27
@coderbirju coderbirju force-pushed the add-details-network-inspect branch from eb356cf to 365205b Compare January 21, 2026 22:35
@coderbirju
Copy link
Contributor Author

Apologies for the late reply, you're right we can skip the assert statements as the field existence is already validated through struct unmarshaling.

@haytok

@coderbirju coderbirju closed this Jan 29, 2026
@coderbirju coderbirju reopened this Jan 29, 2026
Command: func(data test.Data, helpers test.Helpers) test.TestableCommand {
return helpers.Command("network", "inspect", data.Identifier("test-network"))
},
Expected: func(data test.Data, helpers test.Helpers) *test.Expected {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There are no tests for the items added in this PR's changes. Should add assertions for IPv4Address, MacAddress, and IPv6Address.

@AkihiroSuda AkihiroSuda added this to the v2.3.0 milestone Feb 4, 2026
Signed-off-by: Arjun Raja Yogidas <arjunry@amazon.com>
@coderbirju coderbirju force-pushed the add-details-network-inspect branch from 365205b to 0756765 Compare February 9, 2026 23:01
@coderbirju coderbirju requested a review from haytok February 10, 2026 20:06
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants