1
0

Get nginx container id from labelled container

This commit is contained in:
Emmet O'Grady 2017-03-04 14:15:15 -06:00 committed by GitHub
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
}