docker-openvpn icon indicating copy to clipboard operation
docker-openvpn copied to clipboard

Connecting openvpn server to multiple docker networks

Open rsegecin opened this issue 3 years ago • 1 comments

After following the configuration steps on Readme I decided to start OpenVPN with a compose file and it worked great until I tried to connect with other docker networks. Does OpenVPN only allow connection with one docker network? Depending on which network I choose I lose the connection with the internet as well. Trying to debug, when I have OpenVPN configured with interfaces to other networks that can't be accessed through VPN, I'm still able to ping and curl services in other networks from inside the ovpn container.

Follows the compose file:

version: '3.5'

networks:
    api_network:
      external: true
    network:

volumes:
  ovpn-data-volume:
    external: true
  portainer_data:

services:
  portainer:
    restart: always
    image: portainer/portainer-ce
    ports:
      - "8000:8000"
      - "9000:9000"
    networks:
      network:
    volumes:
      - /var/run/docker.sock:/var/run/docker.sock
      - portainer_data:/data

  openvpn:
    restart: always
    cap_add:
    - NET_ADMIN
    image: kylemanna/openvpn
    ports:
    - "1194:1194/udp"
    networks:
      network:
      api_network:
    volumes:
    - ovpn-data-volume:/etc/openvpn

If I leave just the network or(xor) api_network it works as if it is mutually exclusive.

rsegecin avatar Sep 02 '20 03:09 rsegecin

I can only do it with a single network, see https://github.com/kylemanna/docker-openvpn/issues/622

erhan- avatar Dec 18 '20 15:12 erhan-