0

On a Windows machine I am able to use 192.168.65.2 as the address of the host machine both on the host machine and inside any container.

Is there a similar (192.168.xx.x etc.) IP for the host machine on a Mac?

Note: I specifically need the ip address (as in number), not a pseudonym, not a "-network=host" flag for starting a docker container, nor anything along those lines. I specifically need the number address if it exists.

Mitlandir
  • 31
  • 5
  • Why do you specifically need an IP address? On both MacOS and Windows you can generally use the DNS name `host.docker.internal`, and that will generally automatically be resolved to some (not necessarily fixed) IP address; also see [From inside of a Docker container, how do I connect to the localhost of the machine?](https://stackoverflow.com/questions/24319662/from-inside-of-a-docker-container-how-do-i-connect-to-the-localhost-of-the-mach) – David Maze Jun 08 '22 at 11:00
  • It's a long story, but yeah, host.docker.internal won't cut it in my usecase – Mitlandir Jun 08 '22 at 11:03

2 Answers2

0

It looks like 192.168.0.19 gets the job done. Not sure if it's going to be universal on every machine, but it can be extracted by running "ifconfig" and fishing for an IP address there.

Mitlandir
  • 31
  • 5
  • Hi, I'm quite sure that this is your local IP address that it's valid only for you in your LAN. Feel free to edit to avoid confusion. – Valerio Bozz Jun 08 '22 at 16:30
  • Yeah, it's the local address, that's exactly what I needed. I'm making a local dev setup with quite a few services, most of which were made by other teams and some of them tend to get confused when you give them non-IPs as S3 endpoints. I wanted a way around this (really don't want to troubleshoot why they're getting confused) by always using IPs and I've found a way now, so it's all good – Mitlandir Jun 11 '22 at 18:28
0

Any particular IP address will not be portable across systems.

Is there a reason host.docker.internal doesn't work for you?

James Risner
  • 5,451
  • 11
  • 25
  • 47