#275: Added check for whether the ID exists or not instead of opening new FD's
This commit is contained in:
@@ -52,6 +52,10 @@ var containerId string
|
|||||||
|
|
||||||
// form container id of current running container
|
// form container id of current running container
|
||||||
func getThisContainerId() string {
|
func getThisContainerId() string {
|
||||||
|
if len(containerId) > 0 {
|
||||||
|
return containerId
|
||||||
|
}
|
||||||
|
|
||||||
id := ""
|
id := ""
|
||||||
cmd := fmt.Sprintf("cat /proc/self/cgroup | grep memory | tail -1 | cut -d/ -f3 | grep -o -E '[0-9A-z]{64}'")
|
cmd := fmt.Sprintf("cat /proc/self/cgroup | grep memory | tail -1 | cut -d/ -f3 | grep -o -E '[0-9A-z]{64}'")
|
||||||
out, err := exec.Command("bash", "-c", cmd).Output()
|
out, err := exec.Command("bash", "-c", cmd).Output()
|
||||||
|
|||||||
Reference in New Issue
Block a user