Docker container and host network VPN

前端 未结 3 1820
抹茶落季
抹茶落季 2020-12-29 19:37

I\'m trying to run docker image on MacOS with VPN turned on (TUN device). Docker container can access internet, but is not able to access resources behind vpn. What is the r

3条回答
  •  一生所求
    2020-12-29 20:19

    Not sure if it's best solution.

    I took DNS that appears on my host after connecting to VPN

    scutil --dns | grep 'nameserver\[[0-9]*\]'
    nameserver[0] : xxx.xxx.xxx.xxx
    

    Modified docker run command:

    docker run --cidfile="docker.pid" --dns=xxx.xxx.xxx.xxx --publish-all
    

    Now docker container can access resources behind VPN... It works, but I have no idea if it's good or bad...

提交回复
热议问题