To access the host from inside a Docker container, you can use host.docker.internal as a hostname, at least if you're on a Windows or Mac host.

From the Windows command prompt:

C:\>docker run --rm alpine nslookup host.docker.internal
Server:         192.168.65.1
Address:        192.168.65.1:53

Non-authoritative answer:
Name:   host.docker.internal
Address: 192.168.65.2
Final thoughts

Weird how in Linux there's quite a convoluted workaround to do this.

Previous on Docker
Mastodon Mastodon