How to connect (back) docker client to host?

Hi There,
I found loads of references on how to connect docker client (running on Mac) to a docker host running in docker-machine:
$ docker-machine --driver virtualbox create dev
$ docker $(docker-machine env dev)
What I am struggling to find is how to connect back to the docker engine running ‘natively’ (hyperkit) on my machine.
I know I can open a new terminal, but it’s a bad trick, I’d like to get the proper way.

Cheers, Giovanni

This is a known limitation and not exactly clear when reading over docs. You have to find opaque references here and there:

  1. https://docs.docker.com/docker-for-mac/faqs/#how-do-i-connect-from-a-container-to-a-service-on-the-host
  2. Access host (not vm) from inside container

TL;DR you have to create an alias on your loop back to a non-routable IP of your choosing, say a 172.16.x.x that doesn’t conflict.

sudo ifconfig lo0 alias 172.16.1.1

Then you access your host inside containers with 172.16.1.1 for example.