docker running splash container but localhost does

2019-03-31 08:19发布

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:

enter image description here

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

What might have gone wrong in this case? Thanks!

2条回答
beautiful°
2楼-- · 2019-03-31 08:55

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.

查看更多
仙女界的扛把子
3楼-- · 2019-03-31 09:02

@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

查看更多
登录 后发表回答