325 B
325 B
docker 使用技巧
docker 与主机通讯
可使用以下两种方法设置。
- docker run --add-host=host.docker.internal:host-gateway
- docker compose file 中添加
extra_hosts选项
version: '3'
services:
web:
image: nginx
extra_hosts:
- "host.docker.internal:host-gateway"