I’m just setting up docker on my Mac. The installation worked and I got some containers running (following the getting-stared guide), but now I want to connect with my browser to localhost, to show a web app.

For that I’m following this guide: https://docs.docker.com/engine/userguide/containers/usingdocker/

2 Solutions collect form web for “Setting up docker on the mac: Cannot connect via localhost”

Hello the process to start to use docker on mac with docker-machine is like:

Create a new docker machine on virtualbox, you can use a name like “your_vm_name” or just “default” in this way you can not use the name because “default” is a keyword that docker-machine try to use when you don’t specify nothing.

The problem here is, why docker-machine ip your_vm_name doesn’t provide the good ip? Can you copy the result of your command

echo $DOCKER_HOST

Usually it’s 192.168.99.100
thanks a lot

And thanks to GianArb for the very fast answer! That solution works as well.

Just to contribute to the community, I just found out by myself, that the solution was too simple to be true.

Instead of your-vm-name use default (obviously the default-host that is set up by docker), so I just used: