2018年3月5日星期一

docker容器内连接宿主机

参考:https://stackoverflow.com/questions/24319662/from-inside-of-a-docker-container-how-do-i-connect-to-the-localhost-of-the-mach

docker run 增加 --net=host 参数,docker容器中使用127.0.0.1或者0.0.0.0地址就指向了宿主机。--net 参数值默认是 brige。

如果设置--net=host,那么-p port:port则不生效。

没有评论:

发表评论