This commit is contained in:
Umut Polat 2026-04-19 15:25:30 -05:00 committed by GitHub
commit efa3c1845f
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 8 additions and 2 deletions

View file

@ -48,6 +48,11 @@ func (c *DockerCommand) PruneNetworks() error {
return err 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 // Remove removes the network
func (v *Network) Remove() error { func (v *Network) Remove() error {
return v.Client.NetworkRemove(context.Background(), v.Name) return v.Client.NetworkRemove(context.Background(), v.Name)

View file

@ -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("Ingress: ", padding) + strconv.FormatBool(network.Network.Ingress) + "\n"
output += utils.WithPadding("Containers: ", padding) output += utils.WithPadding("Containers: ", padding)
if len(network.Network.Containers) > 0 { inspected, err := network.Inspect()
if err == nil && len(inspected.Containers) > 0 {
output += "\n" output += "\n"
for _, v := range network.Network.Containers { for _, v := range inspected.Containers {
output += utils.FormatMapItem(padding, v.Name, v.EndpointID) output += utils.FormatMapItem(padding, v.Name, v.EndpointID)
} }
} else { } else {