Skip to content

Commit

Permalink
Ignore any .mount cgroup in docker
Browse files Browse the repository at this point in the history
  • Loading branch information
derekwaynecarr committed Jan 13, 2017
1 parent 1fa56cb commit 0435634
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 0 deletions.
4 changes: 4 additions & 0 deletions container/docker/factory.go
Original file line number Diff line number Diff line change
Expand Up @@ -142,6 +142,10 @@ func ContainerNameToDockerId(name string) string {
}

func isContainerName(name string) bool {
// always ignore .mount cgroup even if associated with docker and delegate to systemd
if strings.HasSuffix(name, ".mount") {
return false
}
return dockerCgroupRegexp.MatchString(path.Base(name))
}

Expand Down
21 changes: 21 additions & 0 deletions container/docker/factory_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -49,3 +49,24 @@ func TestEnsureThinLsKernelVersion(t *testing.T) {
}
}
}

func TestIsContainerName(t *testing.T) {
tests := []struct {
name string
expected bool
}{
{
name: "/system.slice/var-lib-docker-overlay-9f086b233ab7c786bf8b40b164680b658a8f00e94323868e288d6ce20bc92193-merged.mount",
expected: false,
},
{
name: "/system.slice/docker-72e5a5ff5eef3c4222a6551b992b9360a99122f77d2229783f0ee0946dfd800e.scope",
expected: true,
},
}
for _, test := range tests {
if actual := isContainerName(test.name); actual != test.expected {
t.Fatalf("%s: expected: %v, actual: %v", test.name, test.expected, actual)
}
}
}

0 comments on commit 0435634

Please sign in to comment.