I am using mageddo/dns-proxy-server in my RoR environment to provide DNS resolution for the docker containers. This works like a treat until I connect to the company VPN. Unfortunately, dns-proxy-server binds to the port 172.17.0.2 which conflicts with the VPN. My other containers are using a different IP range. Here is the docker-compose file:
version: '3.7'
services:
jet-db:
image: postgres:latest
hostname: jet-db
ports:
- 5432:5432
environment:
POSTGRES_USER: '*'
POSTGRES_PASSWORD: '*'
volumes:
- database_data:/var/lib/postgresql/data
sidekiq:
build:
context: .
dockerfile: docker/app/ruby-on-rails.dockerfile
command: bundle exec sidekiq -v
environment:
POSTGRES_URL: 'postgres://db/'
RAILS_CACHE_URL: 'redis://rails-cache:6380/'
links:
- jet-db
- sidekiq-cache
- rails-cache
volumes:
- '.:/app'
sidekiq-cache:
image: redis
hostname: sidekiq-cache
command: redis-server /usr/local/etc/redis/redis.conf
ports:
- 6379:6379
volumes:
- ./docker/redis/sidekiq.conf:/usr/local/etc/redis/redis.conf
rails-cache:
image: redis
hostname: rails-cache
command: redis-server /usr/local/etc/redis/redis.conf
ports:
- 6380:6380
volumes:
- ./docker/redis/rails-cache.conf:/usr/local/etc/redis/redis.conf
mailcatcher:
image: zolweb/docker-mailcatcher:latest
ports:
- "1025:1025"
- "1080:1080"
dns-proxy-server:
image: defreitas/dns-proxy-server:latest
hostname: dns.mageddo
volumes:
- /opt/dns-proxy-server/conf:/app/conf
- /var/run/docker.sock:/var/run/docker.sock
- /etc/resolv.conf:/etc/resolv.conf
network_mode: bridge
ports:
- "5380:5380"
volumes:
database_data:
driver: local
tmp:
driver: local
networks:
default:
driver: bridge
ipam:
config:
- subnet: 169.10.0.0/16
Here is what /etc/resolv.conf looks like when the proxy is running normally without VPN:
:# Dynamic resolv.conf(5) file for glibc resolver(3) generated by resolvconf(8)
# DO NOT EDIT THIS FILE BY HAND -- YOUR CHANGES WILL BE OVERWRITTEN
# 127.0.0.53 is the systemd-resolved stub resolver.
# run "systemd-resolve --status" to see details about the actual nameservers.
# nameserver 8.8.8.8 # dps-comment
# nameserver 127.0.0.53 # dps-comment
nameserver 172.17.0.2 # dps-entry
I am wondering whether there is a way to get dns-proxy-server to bind to a different IP address to avoid the conflict with the VPN.