Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 4 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -30,14 +30,15 @@ $ docker run -d -p 80:80 -p 443:443 \
-v /etc/nginx/vhost.d \
-v /usr/share/nginx/html \
-v /var/run/docker.sock:/tmp/docker.sock:ro \
--label com.github.jrcs.letsencrypt_nginx_proxy_companion.nginx_proxy=true \
jwilder/nginx-proxy
```
The "com.github.jrcs.letsencrypt_nginx_proxy_companion.nginx_proxy=true" label is needed so that the letsencrypt container knows which nginx proxy container to use.

* Second start this container:
```bash
$ docker run -d \
-v /path/to/certs:/etc/nginx/certs:rw \
--volumes-from nginx-proxy \
-v /var/run/docker.sock:/var/run/docker.sock:ro \
jrcs/letsencrypt-nginx-proxy-companion
```
Expand Down Expand Up @@ -73,6 +74,7 @@ $ docker run -d -p 80:80 -p 443:443 \
-v /etc/nginx/vhost.d \
-v /usr/share/nginx/html \
-v /path/to/certs:/etc/nginx/certs:ro \
--label com.github.jrcs.letsencrypt_nginx_proxy_companion.nginx_proxy=truee \
nginx
```

Expand Down Expand Up @@ -148,7 +150,7 @@ $ docker run -d \

* `DEBUG` - Set it to `true` to enable debugging of the entrypoint script and generation of LetsEncrypt certificates, which could help you pin point any configuration issues.

* `NGINX_PROXY_CONTAINER`- If for some reason you can't use the docker --volumes-from option, you can specify the name or id of the nginx-proxy container with this variable.
* The "jrcs.nginx_letsencrypt_companion.is_proxy=true" label - set this label on the nginx-proxy container to tell the docker-letsencrypt-nginx-proxy-companion container to use it as the proxy.

#### Examples:

Expand Down
7 changes: 6 additions & 1 deletion app/entrypoint.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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["com.github.jrcs.letsencrypt_nginx_proxy_companion.nginx_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
}
Expand Down