Skip to content
No description or website provided.
Lua Nginx
Branch: master
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Type Name Latest commit message Commit time
Failed to load latest commit information.


Dynamic reverse proxy for Docker containers

Hosting multiple sites on a single server is nothing new - it's as old as the web itself. nginx already supports this use case, but an nginx.conf file needs to be updated and nginx itself reloaded whenever a config change (e.g. backend server IP address, listening domain name) happens.

This is problematic when using Docker containers as backend servers because typically Docker containers have dynamically assigned IP addresses. doxyproxy solves this by looking up backend server containers' IP addresses on-demand inside the nginx process itself. This is achieved using OpenResty.



docker run -d \
  --label \
  --label com.glassechidna.doxyproxy.HttpPort=80 \

docker run -d \
  --label \
  --label com.glassechidna.doxyproxy.HttpPort=80 \

docker run -d --net=host -v /var/run/docker.sock:/var/run/docker.sock -p 8080:8080 glassechidna/doxyproxy
curl -H 'Host:' http://localhost:8080/ # forwarded to the first container
curl -H 'Host:' http://localhost:8080/ # forwarded to the second container

doxyproxy determines the container to forward traffic to by looking for a container with a matching com.glassechidna.doxyproxy.HttpHost label. doxyproxy then uses the com.glassechidna.doxyproxy.HttpPort label to know which port the web traffic should be forwarded to in that container.

Note: In the above example the --net=host networking mode command is not strictly necessary as the three containers are launched into the same default Docker bridge network and hence the doxyproxy container has connectivity to the other two. Where the host network mode does become necessary is when you wish to forward traffic to containers in other Docker networks.


This project is originally based on the great work done by sourcelair/ceryx.

You can’t perform that action at this time.