Merge pull request 'remove_cgroup' (#1) from remove_cgroup into master

Reviewed-on: #1
This commit is contained in:
jlusiardi 2021-12-18 21:41:29 +00:00
commit 01a848de31
2 changed files with 6 additions and 16 deletions

View File

@ -26,6 +26,9 @@ Since the container uses Docker's internal event reporting, it needs access to t
moment, only access via UNIX socket is possible. Because of that, the socket has to be handed moment, only access via UNIX socket is possible. Because of that, the socket has to be handed
into the container (*-v /var/run/docker.sock:/var/run/docker.sock*). into the container (*-v /var/run/docker.sock:/var/run/docker.sock*).
**Note: do not change hostname for container, since the code relies on the hostname to be
the short id!**
### Single IP / All IPs ### Single IP / All IPs
This option is used if your Docker Host has only one IP or if there is no need to differentiate between different IPs regarding wether a Web App This option is used if your Docker Host has only one IP or if there is no need to differentiate between different IPs regarding wether a Web App
is available on it. is available on it.

View File

@ -172,22 +172,9 @@ def get_pid():
def get_docker_id(): def get_docker_id():
"""This function extracts the container's id from /proc/self/cgroup.""" """This function extracts the container's id from /etc/hostname."""
id = '' with open('/etc/hostname', 'r') as file:
with open('/proc/self/cgroup', 'r') as file: return file.read().strip()
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
def get_listen_ips(): def get_listen_ips():