diff --git a/manager/manager.go b/manager/manager.go index d06f8e80..e5e30952 100644 --- a/manager/manager.go +++ b/manager/manager.go @@ -1136,5 +1136,36 @@ func (m *manager) DockerInfo() (DockerStatus, error) { } func (m *manager) DebugInfo() map[string][]string { - return container.DebugInfo() + debugInfo := container.DebugInfo() + + // Get unique containers. + var conts map[*containerData]struct{} + func() { + m.containersLock.RLock() + defer m.containersLock.RUnlock() + + conts = make(map[*containerData]struct{}, len(m.containers)) + for _, c := range m.containers { + conts[c] = struct{}{} + } + }() + + // List containers. + lines := make([]string, 0, len(conts)) + for cont := range conts { + lines = append(lines, cont.info.Name) + if cont.info.Namespace != "" { + lines = append(lines, fmt.Sprintf("\tNamespace: %s", cont.info.Namespace)) + } + + if len(cont.info.Aliases) != 0 { + lines = append(lines, "\tAliases:") + for _, alias := range cont.info.Aliases { + lines = append(lines, fmt.Sprintf("\t\t%s", alias)) + } + } + } + + debugInfo["Managed containers"] = lines + return debugInfo }