Closed juzeon closed 7 months ago
使用host模式是顾虑到如果配置代理的话(例如本机的7890端口),非网络模式下没法在容器内访问宿主机上的端口。虽然也可以使用172开头的docker0网卡的本机地址,但这样的话就多了一步,无法开箱即用了。
使用代理请用环境变量
environment:
- HTTP_PROXY=http://172.17.0.1:18080
- HTTPS_PROXY=http://172.17.0.1:18080
172.17.0.1
代表宿主机 IP,Windows 和 Mac 系统下是 host.docker.internal
更新了,请看一下。
别用 host 网络模式,用 port 端口转发出来