wfg / docker-openvpn-client

OpenVPN client with killswitch and proxy servers; built on Alpine
MIT License
353 stars 107 forks source link

Using network_mode: container:openvpn-client does not work #67

Closed abrbon closed 2 years ago

abrbon commented 2 years ago

Hi,

Just found this very nice docker container and looked like exactly what i needed. Want to use it for my VPN to use only for specific docker containers.

My setup: a Raspberry Pi 4 (4GB) with Portainer installed.

First thing i noticed is that i needed to make small change in docker-compose lines:

devices:
      - /dev/net/tun:/dev/net/tun

Otherwise it said it could not find the tun device.

So that is now working great and if i go into my openvpn container i can see my VPN IP (curl ifconfig.me) so that seems to be working just fine.

Issue i am stuck at now is when i want another docker container to use the VPN container. I added the "network_mode: container:openvpn-client" line in my stack in portainer i would like to use the VPN but it just fails with message:

Failure
failed to deploy a stack: service with container_name "openvpn-client" not found for network_mode 'container:openvpn-client'

So then i tried to not use the stack (docker-compose) in Portainer but created the container directly within the GUI. That seemed to work, i could change the Network settings to: Network = container and Container = openvpn-client

But now the issue is that i cannot access the service running in that container via the web on my local network. I have already check that i did not use the ports in the container but added the ports in the openvpn-client container within the stack:

ports:
   - 9696:9696

When i try to access the service in that container with the IP of my Raspi (host for my docker container) with the port nr i can not access it.

Al my other containers are working just fine so i has to be something with the openvpn-client container i think.

Any thoughts/help ?

Thanks.

wfg commented 2 years ago

See if this will help: https://github.com/wfg/docker-openvpn-client#subnets

abrbon commented 2 years ago

Got it working now. Of course something simple as a typo 😄

Now for the next step to get it working behind my Nginx proxy manager docker within the same internal network.

wfg commented 2 years ago

Well that'll do it. :)