From f34545435868b7a14428943f41ac6545a059fcae Mon Sep 17 00:00:00 2001 From: Nick Ethier Date: Tue, 11 Aug 2015 15:02:56 -0600 Subject: [PATCH 1/2] Fix getPidForContainer for later releases of docker --- netns_linux.go | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/netns_linux.go b/netns_linux.go index abdc308..97ce6a6 100644 --- a/netns_linux.go +++ b/netns_linux.go @@ -167,8 +167,10 @@ func getPidForContainer(id string) (int, error) { filepath.Join(cgroupRoot, cgroupThis, id, "tasks"), // With more recent lxc versions use, cgroup will be in lxc/ filepath.Join(cgroupRoot, cgroupThis, "lxc", id, "tasks"), - // With more recent dockee, cgroup will be in docker/ + // With more recent docker, cgroup will be in docker/ filepath.Join(cgroupRoot, cgroupThis, "docker", id, "tasks"), + // Even more recent docker versions under systemd use docker-.scope/ + filepath.Join(cgroupRoot, cgroupThis, "docker-" + id + ".scope", tasks"), } var filename string From 0591c3f6370013472c6eaca526375f57bb585ea4 Mon Sep 17 00:00:00 2001 From: Nick Ethier Date: Tue, 11 Aug 2015 15:20:38 -0600 Subject: [PATCH 2/2] Will always be under system.slice on systemd --- netns_linux.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/netns_linux.go b/netns_linux.go index 97ce6a6..bf71c21 100644 --- a/netns_linux.go +++ b/netns_linux.go @@ -170,7 +170,7 @@ func getPidForContainer(id string) (int, error) { // With more recent docker, cgroup will be in docker/ filepath.Join(cgroupRoot, cgroupThis, "docker", id, "tasks"), // Even more recent docker versions under systemd use docker-.scope/ - filepath.Join(cgroupRoot, cgroupThis, "docker-" + id + ".scope", tasks"), + filepath.Join(cgroupRoot, "system.slice", "docker-"+id+".scope", "tasks"), } var filename string