mirror of
https://github.com/weaveworks/scope.git
synced 2026-05-16 06:07:41 +00:00
Don't map IPs for containers that are not running
For instance Kubernetes may have a record of a dead and restarted container in a pod, so both the dead and the live one will map to the same IP address and we would remove that address as ambiguous.
This commit is contained in:
@@ -208,7 +208,11 @@ func MapContainer2IP(rpt report.Report, m report.Node) []string {
|
||||
// we cannot use its IP to attribute connections
|
||||
// (they could come from any other process on the host or DNAT-ed IPs)
|
||||
_, isInHostNetwork := m.Latest.Lookup(docker.IsInHostNetwork)
|
||||
if doesntMakeConnections || isInHostNetwork {
|
||||
// mapping IPs for containers that are not running can confuse the display
|
||||
state, stateFound := m.Latest.Lookup(docker.ContainerState)
|
||||
notRunning := stateFound && state != docker.StateRunning
|
||||
|
||||
if doesntMakeConnections || isInHostNetwork || notRunning {
|
||||
return nil
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user