And I guess it does say that “host.docker.internal” is an invalid IP address. If you read the documentation, you can see that the first part of an extra host is a hostname, the second is an IP address
You can’t use servicename as the first part and you can’t use a hostname as the second part. You could use “host-gateway” instead of an IP address (which is not really well-documented but it is somewhere in one of the docs. I can’t find it now).
I am not sure I understand. Do you want to use the host network? Can you show an example what you are trying to do?
update: I realized you probably want to run something on the host so you want to access it from the container. In that case “host.docker.internal” should work on Mac without additional configuration, but if not, you can set the extra host this way:
If your services are listening on “localhost” and not on the Docker network (172.x.x.x), you need to run your container on the host network.