Docker Community Forums

Share and learn in the Docker community.

Docker for Mac can't publish using IP:port:port - trying to bind container to VPN


(Ndrwstn) #1

I’ve been trying to get started with Docker for Mac, but I’m struggling pretty hard.

I’m working with linuxserver/transmission, as I wanted to start with something I’ve done before (outside of Docker). However, I am having problems getting it to work with my VPN (set up via Network SysPrefs, L2TP over IPSec, ppp0). I don’t want to route all traffic over the VPN, but that seems to be the only way I’ve found to route the traffic.

I’ve tried to set it up using the publish flags

-p 9091:9091
-p (vpn local IP):51413:51413
-p (vpn local IP):51413:51413/udp

which will show up in docker inspect but once the container is started become localhost and still route all the traffic over ethernet. I’ve contemplated using the remote VPN IP address, but that just seems wrong?

Since my VPN connection will die and dynamically give me another IP address, I understand that I’ll likely need to use the docker run command to start up a new container with the correct IP bindings, but I’d settle just to understand/fix why I can’t get this first instance to bind to that ip.

If there’s a better way to do this, I’m all ears. I would like to eventually have a few docker containers bound to my VPN, so I’m open to suggestions, but I’m solidly a 200-level learner here.

Using Docker Community Edition 17.12.0-ce-mac49 (21995) (stable) using macOS 10.13.3 on a MacMini Late 2014.