TL;DR: how do I get a client in my container to make an HTTPS connection to a service on the host?
I've got a service running on a VM on my local dev machine (macOS) that's serving HTTPS on port 8443; it's got a certificate for dev.mycoolproject.com
and dev.mycoolproject.com
has an A
record pointing to 127.0.0.1. So, if I run my client on my local machine and point it to https://dev.mycoolproject.com:8443
it makes a secure connection to my local service.
I want to run my client inside a docker container and still have it connect to that local server on the host. But obviously dev.mycoolproject.com
pointing at 127.0.0.1 won't work, and I can't just use /etc/hosts
to redirect it because the host's IP is dynamic. I can reach the local server at host.docker.internal:8443
, but I'll get TLS errors because the hostname doesn't match.
Is there any way I can get docker's DNS to map dev.mycoolproject.com
to the host IP? I looked into running dnsmasq locally in the container but I had trouble getting it to work.