Skip to content

Instantly share code, notes, and snippets.

@mikew
Last active November 23, 2015 16:38
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save mikew/66e15a8be8eaf7d6043c to your computer and use it in GitHub Desktop.
Save mikew/66e15a8be8eaf7d6043c to your computer and use it in GitHub Desktop.
docker-machine create -d vmwarefusion
docker_machine_create_vmwarefusion () {
  name="${1:-test}"
  dir="${HOME}/.docker/machine/machines/${name}"
  vmx="${dir}/${name}.vmx"
  vmrun="/Applications/VMware Fusion.app/Contents/Library/vmrun"

  # Something about the initial run of docker-machine+vmwarefusion needs sudo
  sudo $(which docker-machine) -D create -d vmwarefusion "${name}"
  
  # Needs to shut down cleanly, which will also need sudo
  sudo "${vmrun}" stop "${vmx}"

  # Change the owner back to current user
  sudo chown -R "${USER}" "${HOME}/.docker"

  # Upgrade the VM hardware
  #"${vmrun}" upgradevm "${vmx}"
  
  echo "You should be able to run 'eval \"\$(docker-machine env ${name})\"'"
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment