mirror of
https://github.com/nginx-proxy/docker-letsencrypt-nginx-proxy-companion
synced 2024-12-03 17:28:20 +01:00
Get nginx container id from labelled container
This commit is contained in:
parent
9c1a7b26e5
commit
3c877181d8
@ -33,9 +33,14 @@ function get_nginx_proxy_cid {
|
||||
break
|
||||
fi
|
||||
done
|
||||
# Check if any container has been labelled as the nginx proxy container.
|
||||
local labeled_cid=$(docker_api "/containers/json" | jq -r '.[] | select( .Labels["jrcs.nginx_letsencrypt_companion.is_proxy"] == "true")|.Id')
|
||||
if [[ ! -z "${labeled_cid:-}" ]]; then
|
||||
export NGINX_PROXY_CONTAINER=$labeled_cid
|
||||
fi
|
||||
if [[ -z "${NGINX_PROXY_CONTAINER:-}" ]]; then
|
||||
echo "Error: can't get nginx-proxy container id !" >&2
|
||||
echo "Check that you use the --volumes-from option to mount volumes from the nginx-proxy." >&2
|
||||
echo "Check that you use the --volumes-from option to mount volumes from the nginx-proxy or label the nginx proxy container to use with 'jrcs.nginx_letsencrypt_companion.is_proxy=true'." >&2
|
||||
exit 1
|
||||
fi
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user