Advertisement
kromm77

DOCKER OVER VMWARE

Nov 13th, 2018
232
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.61 KB | None | 0 0
  1. Install Docker Toolbox without VirtualBox
  2.  
  3. DockerToolbox-.exe /COMPONENTS="Docker,DockerMachine"
  4.  
  5. Replace contents of C:\Program Files\Docker Toolbox\start.sh with this script.
  6. #============================= INIT FILE
  7.  
  8. #!/bin/bash
  9.  
  10. export PATH="$PATH:/mnt/c/Program Files (x86)/VMware/VMware Workstation"
  11.  
  12. trap '[ "$?" -eq 0 ] || read -p "Looks like something went wrong in step ´$STEP´... Press any key to continue..."' EXIT
  13.  
  14. VM=${DOCKER_MACHINE_NAME-default}
  15. DOCKER_MACHINE=./docker-machine.exe
  16.  
  17. BLUE='\033[1;34m'
  18. GREEN='\033[0;32m'
  19. NC='\033[0m'
  20.  
  21.  
  22. if [ ! -f "${DOCKER_MACHINE}" ]; then
  23. echo "Docker Machine is not installed. Please re-run the Toolbox Installer and try again."
  24. exit 1
  25. fi
  26.  
  27. vmrun.exe list | grep \""${VM}"\" &> /dev/null
  28. VM_EXISTS_CODE=$?
  29.  
  30. set -e
  31.  
  32. STEP="Checking if machine $VM exists"
  33. if [ $VM_EXISTS_CODE -eq 1 ]; then
  34. "${DOCKER_MACHINE}" rm -f "${VM}" &> /dev/null || :
  35. rm -rf ~/.docker/machine/machines/"${VM}"
  36. #set proxy variables if they exists
  37. if [ -n ${HTTP_PROXY+x} ]; then
  38. PROXY_ENV="$PROXY_ENV --engine-env HTTP_PROXY=$HTTP_PROXY"
  39. fi
  40. if [ -n ${HTTPS_PROXY+x} ]; then
  41. PROXY_ENV="$PROXY_ENV --engine-env HTTPS_PROXY=$HTTPS_PROXY"
  42. fi
  43. if [ -n ${NO_PROXY+x} ]; then
  44. PROXY_ENV="$PROXY_ENV --engine-env NO_PROXY=$NO_PROXY"
  45. fi
  46. "${DOCKER_MACHINE}" create -d vmwareworkstation $PROXY_ENV "${VM}"
  47. fi
  48.  
  49. STEP="Checking status on $VM"
  50. VM_STATUS="$(${DOCKER_MACHINE} status ${VM} 2>&1)"
  51. if [ "${VM_STATUS}" != "Running" ]; then
  52. "${DOCKER_MACHINE}" start "${VM}"
  53. yes | "${DOCKER_MACHINE}" regenerate-certs "${VM}"
  54. fi
  55.  
  56. STEP="Setting env"
  57. eval "$(${DOCKER_MACHINE} env --shell=bash ${VM})"
  58.  
  59. STEP="Finalize"
  60. clear
  61. cat << EOF
  62.  
  63.  
  64. ## .
  65. ## ## ## ==
  66. ## ## ## ## ## ===
  67. /"""""""""""""""""\___/ ===
  68. ~~~ {~~ ~~~~ ~~~ ~~~~ ~~~ ~ / ===- ~~~
  69. \______ o __/
  70. \ \ __/
  71. \____\_______/
  72.  
  73. EOF
  74. echo -e "${BLUE}docker${NC} is configured to use the ${GREEN}${VM}${NC} machine with IP ${GREEN}$(${DOCKER_MACHINE} ip ${VM})${NC}"
  75. echo "For help getting started, check out the docs at https://docs.docker.com"
  76. echo
  77. cd
  78.  
  79. docker () {
  80. MSYS_NO_PATHCONV=1 docker.exe "$@"
  81. }
  82. export -f docker
  83.  
  84. if [ $# -eq 0 ]; then
  85. echo "Start interactive shell"
  86. exec "$BASH" --login -i
  87. else
  88. echo "Start shell with command"
  89. exec "$BASH" -c "$*"
  90. fi
  91.  
  92.  
  93. #============================= END FILE
  94.  
  95.  
  96. Copy docker-machine-driver-vmwareworkstation.exe in C:\Program Files\Docker Toolbox
  97.  
  98.  
  99. Click on Docker Quickstart
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement