Skip to content

Commit 2ef00ba

Browse files
committed
Include all endpoints in network inspect object
Prior to this change, the "docker network inspect" contains only the endpoints that have active local container. This excludes all the remote and stale endpoints. By including all the endpoints, it makes debugging much simpler and also allows the user to cleanup any stale endpoints using "docker network disconnect -f {network} {endpoint-name}". Signed-off-by: Madhu Venugopal <[email protected]>
1 parent 4e7df42 commit 2ef00ba

File tree

2 files changed

+8
-4
lines changed

2 files changed

+8
-4
lines changed

api/server/router/network/network_routes.go

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -174,11 +174,12 @@ func buildNetworkResource(nw libnetwork.Network) *types.NetworkResource {
174174
continue
175175
}
176176
sb := ei.Sandbox()
177-
if sb == nil {
178-
continue
177+
key := "ep-" + e.ID()
178+
if sb != nil {
179+
key = sb.ContainerID()
179180
}
180181

181-
r.Containers[sb.ContainerID()] = buildEndpointResource(e)
182+
r.Containers[key] = buildEndpointResource(e)
182183
}
183184
return r
184185
}

docs/reference/commandline/network_inspect.md

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,10 @@ bda12f8922785d1f160be70736f26c1e331ab8aaf8ed8d56728508f2e2fd4727
2828
```
2929

3030
The `network inspect` command shows the containers, by id, in its
31-
results. You can specify an alternate format to execute a given
31+
results. For networks backed by multi-host network driver, such as Overlay,
32+
this command also shows the container endpoints in other hosts in the
33+
cluster. These endpoints are represented as "ep-{endpoint-id}" in the output.
34+
You can specify an alternate format to execute a given
3235
template for each result. Go's
3336
[text/template](http://golang.org/pkg/text/template/) package describes all the
3437
details of the format.

0 commit comments

Comments
 (0)