Docker Community Forums

Share and learn in the Docker community.

Docker - Forward port to host with net=container:vpn


(Yoloclin) #1

I wish to connect Docker to a VPN network, while forwarding the port to my host (and exposing to my local network):
docker create --name=vpn_client --net=container:vpn -p 80:80 nginx
but recieve the error
Error response from daemon: conflicting options: port publishing and the container type network mode

Is there a way around this? If I remove -p 80:80 I’m able to communicate with nginx via it’s 172.x IP address on the host which i could forward via socat or similar, but that’s far from optimal.

Thanks :slight_smile: