docker running splash container but localhost does not load (windows 10)

不羁岁月 提交于 2019-12-05 02:50:32

问题


I am following this tutorial to use splash to help with scraping webpages.I installed Docker toolbox and did these two steps:

$ docker pull scrapinghub/splash
$ docker run -p 5023:5023 -p 8050:8050 -p 8051:8051 scrapinghub/splash

I think it is running correctly, based on the prompted message in Docker window, which looks like this:

However, when I open the `localhost:8050' in a web browser, it says the localhost is not working.

What might have gone wrong in this case? Thanks!


回答1:


You have mapped the port to your docker host (the VM), but you have not port-forwarded that same port to your actual "localhost" (your Windows host)

You need to declare that port-forwarding in the Network settings of your VM (for instance "default"), or with VBoxManage controlvm commands.

Then and only then could you access that port (used by your VM) from your Windows host (localhost).

That or you can access that same port using the IP address of your boot2docker VM: see docker-machine ls.




回答2:


@user3768495, when you use http://192.168.99.100:8050/ , you are actually using the docker-machine ip and this ip would be available on your machine only and not on the network. To map it to localhost, you do need to port-forward the same port to your localhost. I was having the same issue and I detailed the process in below link.

https://stackoverflow.com/a/35737787/4820675



来源:https://stackoverflow.com/questions/37891939/docker-running-splash-container-but-localhost-does-not-load-windows-10

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