1

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?

mainframer
  • 17,983
  • 11
  • 45
  • 63
Jackson
  • 5,711
  • 5
  • 31
  • 41

1 Answers1

0

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.

Community
  • 1
  • 1
VonC
  • 1,129,465
  • 480
  • 4,036
  • 4,755