Synchronizing hosts of any DNS server and Proxy server in a stack with docker-gen.
884
Standalone template engine for synchronizing hosts of any DNS server (with support for custom lists, e.g. pi-hole or coredns) and Proxy server in a stack with docker-gen.
When using Nginx Proxy with docker-gen, the proxy server configuration is updated automatically to forward requests to the Docker containers by the hostname specified in VIRTUAL_HOST. hosts-gen works in the same way, getting a list of all VIRTUAL_HOST from containers on remote servers where Proxy is running and updating the host list when there are changes. For this to work, the host list must be synchronized between the DNS server and hosts-gen using the volume mount mechanism. To apply changes to the DNS server (if necessary), you can specify an arbitrary command in POST_COMMAND.
cd $HOME
git clone https://github.com/Lifailon/hosts-gen dns-stack
cd dns-stack
# List of proxy hosts with docker (must specify IP addresses separated by commas)
PROXY_IP_LIST=192.168.3.105,[email protected]:2121
# Specify the proxy address if it is used to forward to all hosts with Docker (by default, each host is also a proxy)
PROXY_IP_ENDPOINT=
# Global parameters for ssh connecting to proxy hosts (lower priority)
SSH_USERNAME=lifailon
SSH_PASSWORD=
SSH_PORT=2121
# Host polling interval
UPDATE_INTERVAL=10s
# Path to hosts file inside container
DNS_HOSTS_PATH=/hostsfile
# The command to be executed after updating the host list
POST_COMMAND="docker exec pihole-server pihole reloaddns"
docker-compose up -d
network_mode: "host") or the current stack:nginx:
image: nginx
environment:
- VIRTUAL_HOST=nginx.local
docker-compose up -d
Within n-seconds (specified in the UPDATE_INTERVAL variable), a new record will be automatically added to the DNS server using hosts-gen and the Nginx configuration will be updated using docker-gen.
http://nginx.local.Content type
Image
Digest
sha256:fb8514af0…
Size
22.6 MB
Last updated
about 1 year ago
docker pull lifailon/hosts-gen