mirror of
https://github.com/nginx-proxy/docker-letsencrypt-nginx-proxy-companion
synced 2024-11-15 13:43:11 +01:00
Fixing get cid to retry alternative sources. Also use regex to exactly match 64 char CID
This commit is contained in:
parent
16e50ac24e
commit
af4784d444
@ -64,10 +64,12 @@ function get_self_cid {
|
||||
|
||||
# Try the /proc files methods first then resort to the Docker API.
|
||||
if [[ -f /proc/1/cpuset ]]; then
|
||||
self_cid="$(basename "$(cat /proc/1/cpuset)")"
|
||||
elif [[ -f /proc/self/cgroup ]]; then
|
||||
self_cid="$(basename "$(cat /proc/self/cgroup | head -n 1)")"
|
||||
else
|
||||
self_cid="$(grep -Eo '[[:alnum:]]{64}' /proc/1/cpuset)"
|
||||
fi
|
||||
if [[ ( ${#self_cid} != 64 ) && ( -f /proc/self/cgroup ) ]]; then
|
||||
self_cid="$(grep -Eo -m 1 '[[:alnum:]]{64}' /proc/self/cgroup)"
|
||||
fi
|
||||
if [[ ( ${#self_cid} != 64 ) ]]; then
|
||||
self_cid="$(docker_api "/containers/$(hostname)/json" | jq -r '.Id')"
|
||||
fi
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user