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?
            Asked
            
        
        
            Active
            
        
            Viewed 489 times
        
    1
            
            
        
        mainframer
        
- 20,411
 - 12
 - 49
 - 68
 
        Jackson
        
- 6,391
 - 6
 - 32
 - 43
 
- 
                    What URL do you try and access in the browser ? – Sachin Malhotra Oct 18 '15 at 05:31
 - 
                    What's system are you running docker? if you are using Mac, it is not '127.0.0.1', it should be the real container ip which you can obtain by issuing commane 'docker-machine ip default`. – mainframer Oct 18 '15 at 07:11
 
1 Answers
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.
- 
                    
 - 
                    @GrahamJackson toolbox, machine, ... if you are using a VM, you need port forwarding. – VonC Oct 17 '15 at 19:24
 - 
                    
 - 
                    1I exposed port 3000 on the host machine, and I'm still getting the same error. – Jackson Oct 17 '15 at 19:46
 - 
                    @GrahamJackson I have changed the VBoxManage command, and integrated mainframer's comment. – VonC Oct 18 '15 at 07:55