A docker container hosting a VPN server needs it outgoing traffic (presumably the internet traffic) to be sent to another container which would send it to the internet.

Following is the idea,

Container A(VPN Server) -> Container B (Specific port) -> Internet

I have tried a couple of things with iptables but was unable to resolve this.

Things I tried

Hosted a redsocks server in Container A along with the VPN.

Container A iptables -t nat -A OUTPUT -p tcp --dport 80 -j REDIRECT --to-port 12345

I have also tried the following,

Container A(VPN Server) -> Container B (Redsocks) -> Container C (Specific port)-> Internet

Please let me know if this is possible or there is an alternative.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.