Search code examples
macosdockerdocker-machine

Docker for Mac VM IP


I just migrated to using Docker for Mac, from previously using Docker Toolbox with virtualbox for OSX.

I used to get the machine IP address with $(docker-machine ip default).

Is there a reliable way to get the Hyperkit IP address?

Thanks!


Solution

  • There's no need for working with the xhyve VM's IP address directly like you would with docker-machine. All port mappings are directly mapped to localhost.

    $ docker run -d -p 8080:80 nginx:latest
    $ curl localhost:8080
    

    Also see the official documentation:

    When you run a container with the -p argument, for example: $ docker run -p 80:80 -d nginx Docker for Mac will make the container port available at localhost.