I have a docker container that houses a OpenVPN service. I am trying to route all the networking from additional containers through the VPN. To do this I am using a docker-compose file that contains: network_mode: “service:vpn”. However it seems that if the vpn container restarts the other containers that are sharing the same networking of the vpn container stop working and do not re-connect when the vpn restarts.
So my question is:
- Is this the expected behavior of docker or am I doing something wrong?
- if it is the expected behavior, is there a better way to do the networking to alleviate this problem? I also have certain services within the additional containers that I need to access. For this I am using a nginx proxy.
My Docker Compose file is located at: https://github.com/kkniffin/usb-mediaserver/blob/master/docker-compose.yml
I appreciate any help with this issue.