File tree 1 file changed +5
-1
lines changed
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 {
199
199
200
200
# Try the /proc files methods first then resort to the Docker API.
201
201
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) "
203
203
fi
204
204
if [[ ( ${# self_cid} ! = 64 ) && ( -f /proc/self/cgroup ) ]]; then
205
205
self_cid=" $( grep -Eo -m 1 ' [[:alnum:]]{64}' /proc/self/cgroup) "
206
206
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
207
211
if [[ ( ${# self_cid} ! = 64 ) ]]; then
208
212
self_cid=" $( docker_api " /containers/$( hostname) /json" | jq -r ' .Id' ) "
209
213
fi
You can’t perform that action at this time.
0 commit comments