fix: populate network containers via NetworkInspect

NetworkList returns network.Summary which doesn't include container
details in the Containers field. This causes the network config panel
to always show 'Containers: none' even when containers are connected
to the network.

Fix by calling NetworkInspect for each network during refresh to get
the full inspect data including connected containers.

Fixes #752
This commit is contained in:
Rodion Steshenko 2026-02-16 21:14:25 -05:00
parent 577797d9ed
commit 177420ea85

View file

@ -29,9 +29,17 @@ func (c *DockerCommand) RefreshNetworks() ([]*Network, error) {
ownNetworks := make([]*Network, len(networks))
for i, nw := range networks {
// NetworkList returns network.Summary which doesn't include container
// details. We need to inspect each network to populate Containers.
inspected, err := c.Client.NetworkInspect(context.Background(), nw.ID, network.InspectOptions{})
if err != nil {
c.Log.WithError(err).Warn("failed to inspect network " + nw.Name)
inspected = nw
}
ownNetworks[i] = &Network{
Name: nw.Name,
Network: nw,
Network: inspected,
Client: c.Client,
OSCommand: c.OSCommand,
Log: c.Log,