diff --git a/containers/registry.go b/containers/registry.go index 94743ef..f76474f 100644 --- a/containers/registry.go +++ b/containers/registry.go @@ -246,8 +246,9 @@ func (r *Registry) getOrCreateContainer(pid uint32) *Container { cmdline := proc.GetCmdline(pid) parts := bytes.Split(cmdline, []byte{0}) if len(parts) > 0 { + cmd := parts[0] lastArg := parts[len(parts)-1] - if bytes.HasSuffix(parts[0], []byte("runsc-sandbox")) && containerIdRegexp.Match(lastArg) { + if (bytes.HasSuffix(cmd, []byte("runsc-sandbox")) || bytes.HasSuffix(cmd, []byte("runsc"))) && containerIdRegexp.Match(lastArg) { cg.ContainerId = string(lastArg) } } @@ -309,6 +310,9 @@ func calcId(cg *cgroup.Cgroup, md *ContainerMetadata) ContainerID { default: return "" } + if cg.ContainerId == "" { + return "" + } if md.labels["io.kubernetes.pod.name"] != "" { pod := md.labels["io.kubernetes.pod.name"] namespace := md.labels["io.kubernetes.pod.namespace"]