Access docker conrainer inside a vm (virtualbox) hosted by windows from a public ip on port 3000

  docker, ruby-on-rails, ubuntu, windows

I’m currently working on a website in rails, inside a vm on xubuntu, (my host is windows 10), my porject is working just fine but it’s not the point why I am here!

The next step I want to climb is to be able to access my website from a public ip on port 3000, for this I am able to do it my self with a server it’s pretty easy.

But now come the tricky part.. my website has to be launch with docker-compose, not a problem you will say and I agree with you, im running rails on 0.0.0.0 and my docker 0.0.0.0:3000->:3000, my vm is bridged with my host!

When I’m running docker-compose up –build, everything work as expected I can now access my website from private ip all around my private network ! Great !

Now the final step and I’m struggling finding info about it, is to make my router redirecting 3000:3000 to this specific private ip from my vm, I opened my port on windows but I don’t think it was necessary but I did it

But why I am trying to acces myip:3000/ it takes times to get an answer so my server is "accessible" but not working at all , when I do
curl myip:3000
im getting a the correct html response redirecting my self to the loggin page

But when I am looking throw the rails log request, I can see that the request got processed
enter image description here

So from this my first a logic guess will be, did you check "your iptables from xbuntu ?" "did you check ufw?"

After few research the problem come with the line "Cannot render console etc…"

So my question how do you allow my public to be able to acces my website from everywhere !
Thanks

Source: Docker Questions

LEAVE A COMMENT