Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

The typical case is that I'm testing with client code on my desktop that expects to talk to some particular server, such as db.work.com, on some particular port, say 3306. I don't want to run the client in a VM or container.

I want to run a test version of that server on a VM or in a container, and have that client connect to it, but I do not want to modify the client.

So I want to make an /etc/hosts entry for db.work.com giving the IP address of the VM or container that I'm running the test server in.

That works great with VMWare Fusion. The VM gets an IP address on my Mac, and I use that in the /etc/hosts entry.

That would also work great if I were running Linux instead of Mac OS, because Docker containers on Linux get IP addresses that are visible. I'd just have to put the container IP on the db.work.com /etc/hosts entry.

On Mac Docker runs a Linux VM and then the containers run in that. They don't have IP addresses that are visible to the Mac. For a lot of things that is fine. With the -p argument you can arrange to have a localhost port mapped to some port on the container.

But in my case that doesn't quite cut it. The client wants to connect to port 3306. I can't just map localhost:3306 to the container and put db.work.com in /etc/hosts pointing to 127.0.0.1 because I've already got something on 127.0.0.1 that is using 3306.

Hence Wireguard so that I can have an IP address for the container that is visible on the Mac.



Consider applying for YC's Summer 2026 batch! Applications are open till May 4

Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: