I am having the same issue. Also using beta 15.
Edit: I found my issue was caused by the application inside docker binding to 127.0.0.1. I changed it to bind to 0.0.0.0 and everything started working. This was not specific to the docker for mac beta.
Yeah, somehow it doesn’t work for me. I’m running a node.js app inside the container and I want it to connect to the MongoDB running on the host. Whatever, I try it fails to connect.
Tried:
Change connection from node.js to mongo to be 0.0.0.0 - fails
Change connection from node.js to mongo to be 127.0.0.1 - fails
Run the container:
docker run -d -p 2222:22 -p 127.0.0.1:27017:27017 nitai/r2
or
docker run -d -p 2222:22 -p 27017:27017 nitai/r2
I see. You are connecting from the container to the host (I misread your initial post). In order to do that, you would need the ip of the host from within the container. There isn’t really a good way of doing this yet. You can see the discussion on here:
Yes, thanks. However, I’m creating a “customer facing” script where I’m trying to shield of all those things. I think I just have to resort to linking and only that is really supported, i.e. running MongoDB in another container and not on the localhost.
Thanks, this was super helpful, setting the Docker configuration in MAC, Docker->Preferences->Daemon->Advanced
Setting the ip address will be the IP address on which the docker port will map to.
{
"debug" : true,
"ip" : "127.0.0.1",
}
Then as per the advise I set my application to run on host - 0.0.0.0