容器连接主机
在 Docker 容器中,我们可以通过 host.docker.internal
来连接主机,这个域名会自动解析到宿主机的 IP 地址。
还可以使用 gateway.docker.internal
访问网关地址。
The host has a changing IP address, or none if you have no network access. We recommend that you connect to the special DNS name host.docker.internal, which resolves to the internal IP address used by the host.
You can also reach the gateway using gateway.docker.internal.
Docker | I want to connect from a container to a service on the host