Can't access Docker's exposed port in Ubuntu

老子叫甜甜 提交于 2019-12-06 03:45:35

Did you solve this? I'm having the same problem - in my case for port 80. For the time being, I've worked around it by using the ip address of the docker host instead of referencing localhost. I'm getting this using /sbin/ifconfig on interface docker0.

Ie:

DOCKER_HOST_IP=`/sbin/ifconfig docker0 | /bin/grep "inet addr" | /bin/cut -d: -f2 | /bin/awk '{print $1}'`

Then

curl http://${DOCKER_HOST_IP} gives me the expected result whereas curl http://localhost fails.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!