We recently discovered the headaches involved with creating and managing multiple docker machines. Simple solution is adding a script to your bash profile ~/.bash_profile.

alias dm='docker-machine'

dmswitch(){  
  if [ -z "$1" ]; then
    echo "error: Expecting a Docker Machine name"
  else
    echo "Attempting to set environment $1"
    eval $(docker-machine env $1)
  fi
}

dmstart(){  
  if [ -z "$1" ]; then
    echo "error: Expecting a Docker Machine name"
  else
    echo "Attempting to start $1"
    dm start $1 && dmswitch $1
  fi
}

This will provide the ability to easily start machines and set the environment or switch to another machine.

Rather than typing docker-machine ls, can instead do dm ls. Starting a machine is a simply dmstart mymachine and this will also switch the environment. Once started, to switch between machines can be done via dmswitch anothermachine.