无法从浏览器中查看在docker容器中运行的rails应用程序 [英] Unable to view rails app running in docker container from browser
问题描述
docker-compose up
后,浏览器中查看 ERR_CONNECTION_REFUSED
。我已经通过 docker run -p 3000:3000 docker_app
尝试端口转发,并且仍然没有。任何想法?如果您使用的是boot2docker或docker工具箱或docker机器(在与Linux不同的操作系统上, VirtualBox VM),这意味着您需要在VM级别转发该端口:
VBoxManage controlvm boot2docker-vm natpf1name ,tcp ,, 3000,,3000
VM需要将该端口从localhost转发到自身,在码头港口映射可以执行之前。
我有一个类似的情况这个答案。 p>
然后尝试访问 http:// $(docker-machine ip default):3000
,as 主要内容评论。
I am running a rails app in a docker container and after executing docker-compose up
I look in the browser and see ERR_CONNECTION_REFUSED
. I have tried port forwarding via docker run -p 3000:3000 docker_app
and still nothing. Any ideas?
If you are using boot2docker or docker toolbox or docker machine (on an OS different from Linux, meaning using a VirtualBox VM), that means you need to forward that port at the VM level itself:
VBoxManage controlvm boot2docker-vm natpf1 "name,tcp,,3000,,3000"
The VM needs to forward that port from localhost to itself, before the docker port mapping can act.
I had a similar case with this answer.
Then try to access http://$(docker-machine ip default):3000
, as mainframer comments.
这篇关于无法从浏览器中查看在docker容器中运行的rails应用程序的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!