How is a Docker Machine marked as active?

Jay Killeen picture Jay Killeen · Oct 19, 2015 · Viewed 14.2k times · Source

I am working through the Docker Machine User Guide over at https://docs.docker.com/v1.5/machine/.

It says:

You can see the machine you have created by running the docker-machine ls command again:

  $ docker-machine ls
  NAME      ACTIVE   DRIVER       STATE     URL
  dev       *        virtualbox   Running   tcp://192.168.99.100:2376

The * next to dev indicates that it is the active host.

When I run this I don't see the * next to any machines. What do I need to do to make the machine be marked as active? Are there any benefits to this?

For example, I am running the Docker Machine on Windows 10, by making it active does it mean I don't have to keep specifying the machine name in my commands such as docker-machine env dev

Answer

Adrian Mouat picture Adrian Mouat · Oct 19, 2015

I think just running the following command should work:

$ eval $(docker-machine env default)

(Where default is the name of the machine).

The reason for the * is to tell you which machine you're currently connected to e.g. if you run docker ps which Docker engine will it talk to?

In the current version of Docker machine, I believe you have to always specify the name.