Sign inSign up

tomashavlas/nginx-le

By tomashavlas

•Updated over 7 years ago

NGINX HTTP and reverse proxy server container image with Certbot

Image
0

150

tomashavlas/nginx-le repository overview

⁠NGINX 1.12 HTTP and reverse proxy server w/ certbot container image

This container image includes NGINX HTTP and reverse proxy server version 1.12 with Certbot based on Debian.

The container image is available on Docker Hub⁠ as tomashavlas/nginx-le:1.12-debian9.

⁠Description

NGINX⁠ is a free, open-source, high-performance HTTP server and reverse proxy, as well as an IMAP/POP3 proxy server.

Certbot⁠ is EFF's tool to obtain certs from Let's Encrypt and (optionally) auto-enable HTTPS on your server. It can also act as a client for any other CA that uses the ACME protocol.

This container image provides containerized packaging of NGINX 1.12 daemon together with Certbot. This image can be used as a base image for other applications based on NGINX 1.12, image can be extended using source-to-image⁠ tool.

⁠Usage

This image can be used as a base image for other applications based on NGINX HTTP and reverse proxy server.

This will create container named nginx-le running NGINX, serving data from /wwwdata directory, and will request certificate from letsencrypt for domain example.com. Port 8080 will be exposed and mapped to the host.

$ docker run -d --name nginx-le -p 8080:8080 -v /wwwdata:/srv/www:Z -e CERTBOT_DOMAIN=example.com -e [email protected] tomashavlas/nginx-le:1.12-debian9

This will create new Docker layered image named nginx-le-app, using source-to-image, while using data available in /wwwdata on the host.

$ s2i build file:///wwwdata tomashavlas/nginx-le:1.12-debian9 nginx-le-app

To run new image, simply execute:

$ docker run -d --name nginx-le -p 8080:8080 -e CERTBOT_DOMAIN=example.com -e [email protected] nginx-app

⁠S2I source repository layout

This image can be extended using source-to-image tool (see Usage section).

Application source code should be located in the root of the source directory.

NOTE: This image extends S2I source repository layout of NGINX 1.12⁠ container image.

⁠Environment variables

This images recognizes the following environment variables that can be set during initialization by passing -e VAR=VALUE to the Docker run command.

CERTBOT_DOMAIN

Comma-separated list of domains to obtain a certificate for.

CERTBOT_EMAIL

Email address for important account notifications.

NOTE: This image includes support for environment variables defined by NGINX 1.12⁠ container image.

⁠Volumes

The following mount points can be set by passing -v /host/path:/container/path to the Docker run command.

/etc/letsencrypt

Certbot data directory.

/var/log/letsencrypt

Certbot log directory.

NOTE: This image includes support for volumes defined by NGINX 1.12⁠ container image.

⁠Troubleshooting

The NGINX daemon in the container logs to the standard output by default, so the logs are available in container log. The log can be examined by running:

$ docker logs <container>

The Certbot process logs are stored in /var/log/letsencrypt volume. The log can be examined by running:

$docker exec <container> cat /var/log/letsencrypt/*

⁠See also

Dockerfile and other sources for this container image are available on https://github.com/tomashavlas/container-nginx-le⁠.

Tag summary

Content type

Image

Digest

Size

84.4 MB

Last updated

over 7 years ago

docker pull tomashavlas/nginx-le:1.12-debian9