We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
2 parents 624a9ec + cf43aca commit c99e656Copy full SHA for c99e656
app/functions.sh
@@ -199,11 +199,15 @@ function get_self_cid {
199
200
# Try the /proc files methods first then resort to the Docker API.
201
if [[ -f /proc/1/cpuset ]]; then
202
- self_cid="$(grep -Eo '[[:alnum:]]{64}' /proc/1/cpuset)"
+ self_cid="$(grep -Eo -m 1 '[[:alnum:]]{64}' /proc/1/cpuset)"
203
fi
204
if [[ ( ${#self_cid} != 64 ) && ( -f /proc/self/cgroup ) ]]; then
205
self_cid="$(grep -Eo -m 1 '[[:alnum:]]{64}' /proc/self/cgroup)"
206
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
211
if [[ ( ${#self_cid} != 64 ) ]]; then
212
self_cid="$(docker_api "/containers/$(hostname)/json" | jq -r '.Id')"
213
0 commit comments