NGINX HTTP and reverse proxy server container image with Certbot
150
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.
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.
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
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.
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.
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.
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/*
Dockerfile and other sources for this container image are available on https://github.com/tomashavlas/container-nginx-le.
Content type
Image
Digest
Size
84.4 MB
Last updated
over 7 years ago
docker pull tomashavlas/nginx-le:1.12-debian9