nginx-proxy runs nginx with docker-gen to publish routes for other containers. Backends declare a VIRTUAL_HOST variable so traffic reaches the right service.
Overview
nginx-proxy is an automated reverse proxy stack for Docker environments. It runs nginx alongside docker-gen, which watches container lifecycle events, writes nginx configuration, and reloads nginx when services start or stop.
Applications you want exposed set a VIRTUAL_HOST environment variable with the hostname they should answer on. When DNS for that name points at the machine running nginx-proxy, incoming HTTP requests are forwarded to the matching container.
Proxied containers must share a Docker network with the proxy container; by default that means the bridge network unless you attach additional networks when creating the proxy. Port numbers in VIRTUAL_HOST are not supported; separate options cover custom virtual ports or external HTTP and HTTPS ports.
Published images include Debian- and Alpine-based variants, plus a dockergen-only image for pairing with the official nginx image in a multi-container layout.
Key features
- Automatic nginx config generation
- docker-gen container lifecycle hooks
- VIRTUAL_HOST based routing
- Dynamic nginx reload on changes
- Debian and Alpine image variants
- Separate dockergen image option
- Multi-container Docker networking
- Hostname to container mapping
Use cases
- Exposing many Docker apps on one host
- Name-based routing to containers
- Hands-off reverse proxy updates
- Local dev stacks with custom domains
- Split nginx and dockergen deployments