From fdf25b8c66dfd8c930f36cea8d21c0c4d5d770e4 Mon Sep 17 00:00:00 2001 From: DDSRem <1448139087@qq.com> Date: Sat, 23 Sep 2023 16:04:25 +0800 Subject: [PATCH] fix: container id retrieval error --- app/utils/system.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/app/utils/system.py b/app/utils/system.py index 2776ccf3..c343c194 100644 --- a/app/utils/system.py +++ b/app/utils/system.py @@ -343,9 +343,9 @@ class SystemUtils: # 获取当前容器的 ID with open('/proc/self/mountinfo', 'r') as f: data = f.read() - index_resolv_conf = data.find("resolv.conf") + index_resolv_conf = data.find("/sys/fs/cgroup/devices") if index_resolv_conf != -1: - index_second_slash = data.rfind("/", 0, index_resolv_conf) + index_second_slash = data.rfind(" ", 0, index_resolv_conf) index_first_slash = data.rfind("/", 0, index_second_slash) + 1 container_id = data[index_first_slash:index_second_slash] if not container_id: