如果是命令行启动,添加如下参数:

--add-host=host.docker.internal:host-gateway

如果是docker-compose.xml启动,添加如下参数:

extra_hosts:
      - host.docker.internal:host-gateway

然后将 localhost或者是 127.0.0.1 替换成 host.docker.internal

Last modification:June 13, 2022
If you think my article is useful to you, please feel free to appreciate