This folder contains a Dockerfile
for building an nginx
Docker image from an Ubuntu 14.04 LTS
base image.
Unlike the Ubuntu 12.04 configuration, this image uses the phusion/baseimage docker image.
Clone the repository
export IMGTAG="pitrho/trusty-nginx"
git clone https://github.com/pitrho/docker-nginx.git
cd docker-nginx/ubuntu/14.04
docker build -t $IMGTAG .
Verify you have the image locally
docker images | grep "$IMGTAG"
The image can be run in three separate modes: docker-gen, rancher-gen and default
To use docker-gen, you must set environment variable NGINX_RUN_TYPE to docker-gen. In addition, you must mount the docker socket as a volume into the container (e.g. -v /var/run/docker.sock:/tmp/docker.sock). Please consult the docker-gen documentation to see all options available to this program.
To use docker-gen, you must set environment variable NGINX_RUN_TYPE to rancher-gen. In addition, you need to pass the following environment variables:
- RANCHER_GEN_HOST: The ip or dns name of the Rancher server
- RANCHER_GEN_ACCESS_KEY: The Rancher access key
- RANCHER_GEN_SECRET_KEY: The Rancher secret key
- RANCHER_GEN_PROJECT_ID: The project id from Rancher
- RANCHER_GEN_OPTIONS(optional): You can pass additional values to rancher-gen using this variable.
To render multiple templates using rancher-gen, you can pass environment variable RANCHER_GEN_TEMPLATE_X, where x is from 1 to infinity. Examples:
RANCHER_GEN_TEMPLATE_1:/tmp/template1.j2:/tmp/output1.txt
RANCHER_GEN_TEMPLATE_2:/tmp/template2.j2:/tmp/output2.txt
Please consult the rancher-gen documentation for more details.
Default mode simply runs nginx with its default configuration.
To create one or more users for basic http auth, you can pass the environment variable HTTPPWD_X, where X is from 1 to infity. Example:
HTTPPWD_1=user1:pwd1
HTTPPWD_2=user2:pwd2