From f2620c76ce15533b751d813d538cef0302a7f436 Mon Sep 17 00:00:00 2001 From: umut-polat <52835619+umut-polat@users.noreply.github.com> Date: Fri, 6 Mar 2026 17:55:55 +0000 Subject: [PATCH] fix: show containers in network config view NetworkList does not populate the Containers field in the response. When viewing a network's config, the Containers section always showed 'none' regardless of how many containers were attached. Use NetworkInspect to fetch full network details including connected containers when rendering the config panel. Fixes #752 --- pkg/commands/network.go | 5 +++++ pkg/gui/networks_panel.go | 5 +++-- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/pkg/commands/network.go b/pkg/commands/network.go index 74379ef08..c2a4a9ddb 100644 --- a/pkg/commands/network.go +++ b/pkg/commands/network.go @@ -48,6 +48,11 @@ func (c *DockerCommand) PruneNetworks() error { return err } +// Inspect fetches the full network details including containers +func (v *Network) Inspect() (network.Inspect, error) { + return v.Client.NetworkInspect(context.Background(), v.Network.ID, network.InspectOptions{}) +} + // Remove removes the network func (v *Network) Remove() error { return v.Client.NetworkRemove(context.Background(), v.Name) diff --git a/pkg/gui/networks_panel.go b/pkg/gui/networks_panel.go index 4702d35dd..5cfdcf38a 100644 --- a/pkg/gui/networks_panel.go +++ b/pkg/gui/networks_panel.go @@ -64,9 +64,10 @@ func (gui *Gui) networkConfigStr(network *commands.Network) string { output += utils.WithPadding("Ingress: ", padding) + strconv.FormatBool(network.Network.Ingress) + "\n" output += utils.WithPadding("Containers: ", padding) - if len(network.Network.Containers) > 0 { + inspected, err := network.Inspect() + if err == nil && len(inspected.Containers) > 0 { output += "\n" - for _, v := range network.Network.Containers { + for _, v := range inspected.Containers { output += utils.FormatMapItem(padding, v.Name, v.EndpointID) } } else {