1

I have an app is dockerized, then I need to make this app work with VPN, so I need to install openvpn and run it inside my container. I use docker desktop for window 10. I have run these below commands:

1. Open first cmd, create a container: docker run -t -d --cap-add=NET_ADMIN debian:bullseye
2. Connect to my container: docker exec -it <MY_CONTAINER_ID> /bin/bash
3. Check my IP: curl ifconfig.me -> OK I got my IP address. It can connect to internet
4. Install openvpn: apt-get update && apt-get install -y dialog apt-utils && apt-get install -y -q --no-install-recommends openvpn procps curl
5. Create a /dev/net/tun device manually: mkdir -p /dev/net && mknod /dev/net/tun c 10 200 && chmod 600 /dev/net/tun
6. Copy my openvpn config file to container: docker cp test.opvn <MY_CONTAINER_ID>:/
7. Run openvpn: openvpn --config /test.opvn -> I got successful connection.
8. I open a new second cmd and connect my container again: docker exec -it <MY_CONTAINER_ID> /bin/bash
9. Check my IP: curl ifconfig.me -> timeout. So my container is diconnect from internet
10. Back to my first cmd. It is running a vpn connection in interactive mode. I cancel it by pressing Ctrl+C -> VPN disconnection
11. Back to my second cmd then check my IP again: curl ifconfig.me -> OK I got my IP address. It can connect to internet

I know the problem may be vpn server, so I try to test test.opvn in my laptop -> It work. Therefore, I think the problem may be vpn connection with docker, but I can't find solution, so please help.

asked Nov 8, 2024 at 10:27
0

0

Know someone who can answer? Share a link to this question via email, Twitter, or Facebook.

Your Answer

Draft saved
Draft discarded

Sign up or log in

Sign up using Google
Sign up using Email and Password

Post as a guest

Required, but never shown

Post as a guest

Required, but never shown

By clicking "Post Your Answer", you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.