I might be reading this wrong, but is this something where you could launch your containerized app running on whatever port, and map it to `localhost:443` using something along the lines of `docker run -p 127.0.0.1:443:<whatever port in the container> My-App-Image` ? (might need sudo). I read this as wanting to have <your IP>:443 proxy to the container. Hope I'm not crazy.
tzs|3 years ago
If I were running Docker on Linux this would not be a problem. I'd simply use bridged networking in the container which would give the container an IP that works for things running on the Linux host.
To access something on <whatever port in the container> I'd then just use <container IP>:<whatever port in the container>.
Docker Mac runs a Linux VM and then runs your containers on that Linux VM. Bridged networking there just bridges the containers to the Linux VM. The container's IP is not visible to the Mac, just to the Linux VM.
So I'm using Wireguard to tunnel between the Linux VM and the Mac, so that the container IPs end up visible on the Mac.
In case anyone else finds this useful, here are details of my setup.
• I've got a Docker network name "Mynet" that I put containers on with statically assigned IP addresses (e.g., "--network Mynet --ip 10.11.12.10"). Mynet has gateway 10.11.12.1. It was created with this command:
docker network create --driver=bridge --subnet 10.11.12.0/24 --ip-range=10.11.12.128/25 --gateway=10.11.12.1 Mynet
IP address 10.11.12.128-254 are dynamically allocated to containers that are run with "---network Mynet" but not assigned a static IP. 10.11.12.2-127 can be used for static IPs.
• On the Wireguard tunnel, I've given my Mac IP 10.11.0.2 and the Docker Linux VM IP 10.11.0.3.
• The Mac IP address on my home network is 192.168.0.2.
• I've made a Docker alpine image, which I named alpine-wg, that is just the base alpine image with the Wireguard tools installed. The Docker Mac Linux VM has Wireguard kernel support built in, so you just need an image with the tools in order to configure it.
• I've generated key pairs for the Mac and the Linux VM.
• Here is my Wireguard conf file for the Mac (stored on Mac as ~/wg/mac/wg.conf).
• Here is the Wireguard conf file for the Linux VM (stored on Mac as ~/wg/linux-vm/base.conf): • Commands to run on the Mac: • Aliases on the Mac to bring up, take down, and show the tunnel on the Linux VM:ammanley|3 years ago
EDIT: Is your home IP address for your mac static? Seems like if it was dynamic, this would need to be updated, though I know you can use some simple programs to dynamically inquire for the IP, and then just template it out into the config files before launching, just in case.
skydhash|3 years ago