remove_cgroup #1

Merged
jlusiardi merged 2 commits from remove_cgroup into master 2021-12-18 22:41:29 +01:00
1 changed files with 3 additions and 16 deletions
Showing only changes of commit 6b5b1a31e2 - Show all commits

View File

@ -172,22 +172,9 @@ def get_pid():
def get_docker_id():
"""This function extracts the container's id from /proc/self/cgroup."""
id = ''
with open('/proc/self/cgroup', 'r') as file:
lines = file.read().split('\n')
for line in lines:
index = line.find('docker-')
if index != -1:
id = line[index+7:-6]
break
index = line.find('docker/')
if index != -1:
id = line[index+7:]
break
if id == '':
logging.error('could not determine container\'s id!')
return id
"""This function extracts the container's id from /etc/hostname."""
with open('/etc/hostname', 'r') as file:
return file.read().strip()
def get_listen_ips():