8

Within MacOS, I have created 2 docker machines, say, dev1 and dev2. In one terminal running $docker-machine active shows dev1 as an active docker-machine and in the other, dev2. Now I want to switch to dev2 in the 1st terminal (without stopping/removing etc. dev1) so that I'll have dev2 in both.

How do I do this? Thanks!

alisa
  • 1,336
  • 2
  • 15
  • 21

3 Answers3

17

run command in your terminal eval $(docker-machine env [machine-name]) Run docker-machine ls to get available machines list

Vaidas Lungis
  • 1,381
  • 8
  • 16
1

So I have been researching on this for some time and what I found is that I have to run $eval "$(docker-machine env dev2)" in Terminal 1.

alisa
  • 1,336
  • 2
  • 15
  • 21
0

You can do this with the docker-machine env command. For example:

$ eval "$(docker-machine env <machine-name>)"

This will set environment variables that the Docker client will read which specify the TLS settings. Note that you will need to do that every time you open a new tab or restart your machine.

To see what will be set, run docker-machine env

$ docker-machine env <machine-name>
export DOCKER_TLS_VERIFY="1"
export DOCKER_HOST="tcp://172.16.62.130:2376"
export DOCKER_CERT_PATH="/Users/<your username>/.docker/machine/machines/dev"
export DOCKER_MACHINE_NAME="dev"
Hemerson Varela
  • 24,034
  • 16
  • 68
  • 69