Stack with a vpn inside, how to access non-vpn services from one that is using vpn?

Hi!

I have a stack setup with a bunch of different services, and I recently put a VPN in (gluetun image), which I have one service connected through using network_mode: service:gluetun

That all works great. Everybody can see and talk to each other (although I had to put an alias on the vpn service to the service that is now running through it) and it’s all working fine.

However, the service that is connecting through the VPN is now going through the VPN’s DNS, overriding Docker’s DNS, and so it can no longer resolve service/container names inside the stack. It can still reach them using IPs, but cannot resolve them.

What’s the play here? I don’t want the entire stack on the VPN, but I do need the service that is on the VPN to be able to communicate with the rest of the stack. Clearly using IPs inside the stack is not the correct play, though it does work for the moment.

** edit/update: setting env DNS_KEEP_NAMESERVER=on in gluetun is sufficient to solve the problem for me **

Why does it need to access other services?
The VPN should only be needed for the downloading, from then it’s files in storage that other services should take over from, right?

Because it needs to send information to some of the other containers which it does via tcpip

Not all programs work with file system communication :slight_smile:

But this should be a simple problem but there’s not an obvious way in rocket to solve it because of the DNS issues docker presents.

For most of the things that it does, it uses local service detection methods, which work fine (as I said, I can access all the other containers from it, as expected) but I need it to communicate to a specific container host, which it can’t do because that container does not have any local service detection method, and it can’t find the IP for it anymore because the VPN overrides the Docker DNS. If the VPN added to the Docker DNS, or for that matter, just left Docker DNS in place, that would work, but I can’t seem to figure that one out.

** edit: env DNS_KEEP_NAMESERVER=on is sufficient **