18
18
19
19
dockerIdRegexp = regexp .MustCompile (`([a-z0-9]{64})` )
20
20
crioIdRegexp = regexp .MustCompile (`crio-([a-z0-9]{64})` )
21
+ containerdIdRegexp = regexp .MustCompile (`cri-containerd-([a-z0-9]{64})` )
21
22
lxcIdRegexp = regexp .MustCompile (`/lxc/([^/]+)` )
22
23
systemSliceIdRegexp = regexp .MustCompile (`(/system\.slice/([^/]+))` )
23
24
)
@@ -29,6 +30,7 @@ const (
29
30
ContainerTypeStandaloneProcess
30
31
ContainerTypeDocker
31
32
ContainerTypeCrio
33
+ ContainerTypeContainerd
32
34
ContainerTypeLxc
33
35
ContainerTypeSystemdService
34
36
)
@@ -41,6 +43,8 @@ func (t ContainerType) String() string {
41
43
return "docker"
42
44
case ContainerTypeCrio :
43
45
return "crio"
46
+ case ContainerTypeContainerd :
47
+ return "cri-containerd"
44
48
case ContainerTypeLxc :
45
49
return "lxc"
46
50
case ContainerTypeSystemdService :
@@ -184,11 +188,15 @@ func containerByCgroup(path string) (ContainerType, string, error) {
184
188
return ContainerTypeUnknown , "" , fmt .Errorf ("invalid docker cgroup %s" , path )
185
189
}
186
190
return ContainerTypeDocker , matches [1 ], nil
187
- case "kubepods" :
191
+ case "kubepods" , "kubepods.slice" :
188
192
crioMatches := crioIdRegexp .FindStringSubmatch (path )
189
193
if crioMatches != nil {
190
194
return ContainerTypeCrio , crioMatches [1 ], nil
191
195
}
196
+ containerdMatches := containerdIdRegexp .FindStringSubmatch (path )
197
+ if containerdMatches != nil {
198
+ return ContainerTypeContainerd , containerdMatches [1 ], nil
199
+ }
192
200
matches := dockerIdRegexp .FindStringSubmatch (path )
193
201
if matches == nil {
194
202
return ContainerTypeUnknown , "" , fmt .Errorf ("invalid docker cgroup %s" , path )
0 commit comments