Exploring the Docker Machine

Learn what more we can do using the Docker machine.

Configuring the Docker CLI

There is yet another way to perform actions on our docker-machine-managed instance: we can configure our (local) Docker client to talk to our new instance’s Docker Engine. This is a huge benefit of Docker’s client-server architecture.

We can use the same commands with the client CLI locally and have it take effect on any remote machine of our choosing. We simply configure our CLI to point to different machines.

Environment variables

Configuring the Docker CLI to point at a different instance’s Docker Engine is done via environment variables. However, we don’t have to manage them manually. Docker Machine provides a shortcut.

The final line in the output we created our new instance said:

To see how to connect your Docker Client to the Docker Engine running on
this virtual machine, run: docker-machine env local-vm-1

The output after running this is:

Get hands-on with 1400+ tech skills courses.