Public | Automated Build

Last pushed: 2 years ago
Short Description
Short description is empty for this repo.
Full Description

nginx-proxy sets up a container running nginx and docker-gen. docker-gen generate reverse proxy configs for nginx and reloads nginx when containers they are started and stopped.

See Automated Nginx Reverse Proxy for Docker for why you might want to use this.


To build it:

$ docker build -t camomile/nginx-proxy .

To run it:

$ docker run -d -p 80:80 -v /var/run/docker.sock:/tmp/docker.sock camomile/nginx-proxy

Then start any container you want proxied with env vars and VIRTUAL_PATH=location

$ docker run -e -e VIRTUAL_PATH=baz ...

Provided your DNS is setup to forward to the a host running nginx-proxy, a request to will be routed to the container with the matching VIRTUAL_HOST and VIRTUAL_PATH env vars set.

Multiple Ports

If your container exposes multiple ports, nginx-proxy will default to the service running on port 80. If you need to specify a different port, you can set a VIRTUAL_PORT env var to select a different one. If your container only exposes one port and it has a VIRTUAL_HOST env var set, that port will be selected.

Multiple Hosts

If you need to support multipe virtual hosts for a container, you can separate each entry with commas. For example,,, and each host will be setup the same.

Camomile setup

nginx proxy

$ docker run -d -p 80:80 -v /var/run/docker.sock:/tmp/docker.sock camomile/nginx-proxy

Camomile REST API (at

$ docker run -d \
  -v /path/to/the/database:/data/db \                   # Database is stored locally in /path/to/the/database 
  --name mongodb dockerfile/mongodb

$ docker run -d \
  -e -e VIRTUAL_PATH=api \     # nginx-proxy redirects from
  -e ROOT_PASSWORD=R00t.p455w0rd                        # API root password is R00t.p455w0rd 
  -v /path/to/media:/media \                            # Media files are stored locally in /path/to/media
  --link mongodb:mongodb \                              # API is linked to this MongoDB instance
  --name camomile_api camomile/api                 

Camomile Touch Web App (at

$ docker run -d \
  -e -e VIRTUAL_PATH=touch \   # nginx-proxy redirects from
  -e \                     # Web app speaks with API at 
  --name camomile_touch camomile/touch

Camomile Admin Web App (at

$ docker run -d \
  -e -e VIRTUAL_PATH=admin \   # nginx-proxy redirects from
  -e \                     # Wep app speaks with API at
  --name camomile_admin camomile/admin
Docker Pull Command
Source Repository