File tree Expand file tree Collapse file tree 1 file changed +5
-1
lines changed Expand file tree Collapse file tree 1 file changed +5
-1
lines changed Original file line number Diff line number Diff line change @@ -199,11 +199,15 @@ function get_self_cid {
199199
200200 # Try the /proc files methods first then resort to the Docker API.
201201 if [[ -f /proc/1/cpuset ]]; then
202- self_cid=" $( grep -Eo ' [[:alnum:]]{64}' /proc/1/cpuset) "
202+ self_cid=" $( grep -Eo -m 1 ' [[:alnum:]]{64}' /proc/1/cpuset) "
203203 fi
204204 if [[ ( ${# self_cid} ! = 64 ) && ( -f /proc/self/cgroup ) ]]; then
205205 self_cid=" $( grep -Eo -m 1 ' [[:alnum:]]{64}' /proc/self/cgroup) "
206206 fi
207+ # cgroups v2
208+ if [[ ( ${# self_cid} ! = 64 ) && ( -f /proc/self/mountinfo ) ]]; then
209+ self_cid=" $( grep ' /userdata/hostname' /proc/self/mountinfo | grep -Eo -m 1 ' [[:alnum:]]{64}' ) "
210+ fi
207211 if [[ ( ${# self_cid} ! = 64 ) ]]; then
208212 self_cid=" $( docker_api " /containers/$( hostname) /json" | jq -r ' .Id' ) "
209213 fi
You can’t perform that action at this time.
0 commit comments