mirror of
https://github.com/jesseduffield/lazydocker.git
synced 2026-07-25 08:31:03 +00:00
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:
parent
577797d9ed
commit
177420ea85
1 changed files with 9 additions and 1 deletions
|
|
@ -29,9 +29,17 @@ func (c *DockerCommand) RefreshNetworks() ([]*Network, error) {
|
||||||
ownNetworks := make([]*Network, len(networks))
|
ownNetworks := make([]*Network, len(networks))
|
||||||
|
|
||||||
for i, nw := range 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{
|
ownNetworks[i] = &Network{
|
||||||
Name: nw.Name,
|
Name: nw.Name,
|
||||||
Network: nw,
|
Network: inspected,
|
||||||
Client: c.Client,
|
Client: c.Client,
|
||||||
OSCommand: c.OSCommand,
|
OSCommand: c.OSCommand,
|
||||||
Log: c.Log,
|
Log: c.Log,
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue