Docker Community Forums

Share and learn in the Docker community.

Port Access to Containers Behind VPN

Hey Guys,

Currently have multiple containers operating through a VPN container.

Issue:
Containers are accessible from there respective ports via localhost, 0.0.0.0 and 127.0.0.1 but are not accessible from IP address of machine or from other machines in the network.

What i have found:

  • Ports don’t appear listening on the host
  • made sure that Ubuntu ufw has the required ports allowed
  • all containers are accessible on local and IP when not situated behind the VPNcontainer
  • tried ssh tunnel from IP to localhost but didn’t seem to work.

VPNcontainer
[surfsharkVPN]
docker create
–name=surfsharkVPN
–detach=true
–init
–cap-add=NET_ADMIN
–env=USER=USER
–env=PASS=PASS
–env=LOCATION=au
misioslav/surfshark:latest

linked containers are linked to VPN through --net=container:surfsharkVPN

I’m guessing its got something to do with the docker eth bridge or the VPNcontainers IP routing.
Is there a way to route say 8080 directly through from host -> VPNcontainer -> container.
OR
bind the ip to direct port traffic to 0.0.0.0/localhost?