mirror of https://github.com/docker/docs.git
Removed the need for sed in the startup script on windows, and made it more defensible
Signed-off-by: Jeffrey Morgan <jmorganca@gmail.com>
This commit is contained in:
parent
cc4b0142d3
commit
a83c1222be
|
|
@ -4,38 +4,35 @@ trap '[ "$?" -eq 0 ] || read -p "Looks like something went wrong... Press any ke
|
|||
|
||||
VM=default
|
||||
DOCKER_MACHINE=./docker-machine.exe
|
||||
VBOXMANAGE=/c/Program\ Files/Oracle/VirtualBox/VBoxManage.exe
|
||||
|
||||
BLUE='\033[1;34m'
|
||||
GREEN='\033[0;32m'
|
||||
NC='\033[0m'
|
||||
|
||||
if [ ! -f $DOCKER_MACHINE ] || [ ! -f $VBOXMANAGE ]; then
|
||||
if [ ! -f $DOCKER_MACHINE ] || [ ! -f /c/Program\ Files/Oracle/VirtualBox/VBoxManage.exe ]; then
|
||||
echo "Either VirtualBox or Docker Machine are not installed. Please re-run the Toolbox Installer and try again."
|
||||
exit 1
|
||||
fi
|
||||
|
||||
$VBOXMANAGE showvminfo $VM &> /dev/null
|
||||
/c/Program\ Files/Oracle/VirtualBox/VBoxManage.exe showvminfo $VM &> /dev/null
|
||||
VM_EXISTS_CODE=$?
|
||||
|
||||
set -e
|
||||
|
||||
if [ $VM_EXISTS_CODE -ne 0 ]; then
|
||||
if [ $VM_EXISTS_CODE -eq 1 ]; then
|
||||
echo "Creating Machine $VM..."
|
||||
$DOCKER_MACHINE rm -f $VM &> /dev/null || :
|
||||
rm -rf ~/.docker/machine/machines/$VM
|
||||
$DOCKER_MACHINE create -d virtualbox --virtualbox-memory 2048 $VM
|
||||
$DOCKER_MACHINE -D create -d virtualbox --virtualbox-memory 2048 $VM
|
||||
else
|
||||
echo "Machine $VM already exists."
|
||||
echo "Machine $VM already exists in VirtualBox."
|
||||
fi
|
||||
|
||||
echo "Starting machine $VM..."
|
||||
$DOCKER_MACHINE start $VM
|
||||
|
||||
echo "Setting environment variables for machine $VM..."
|
||||
./docker-machine.exe env $VM | sed 's,\\,\\\\,g' # eval swallows single backslashes in windows style path
|
||||
|
||||
eval "$($DOCKER_MACHINE env $VM 2>/dev/null | sed 's,\\,\\\\,g')"
|
||||
eval "$($DOCKER_MACHINE env $VM 2>/dev/null)"
|
||||
|
||||
clear
|
||||
cat << EOF
|
||||
|
|
|
|||
Loading…
Reference in New Issue