-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathupMachine.ps1
26 lines (22 loc) · 1.02 KB
/
upMachine.ps1
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
$machineName = "isolationlevels"
$dockerMachines = docker-machine ls
if ($dockerMachines -Like "*$machineName*") {
echo "Starting docker machine..."
docker-machine start $machineName
docker-machine env $machineName
&docker-machine env $machineName | Invoke-Expression
echo "Docker machine started."
} else {
echo "Creating docker machine..."
docker-machine create --driver virtualbox --virtualbox-disk-size "2000" --virtualbox-memory "4096" --virtualbox-cpu-count "2" --virtualbox-hostonly-cidr "192.168.90.1/24" $machineName
docker-machine start $machineName
docker-machine env $machineName
&docker-machine env $machineName | Invoke-Expression
echo "Docker machine created."
docker-machine start $machineName
echo "Setting ports forwarding on Oracle VirtualBox machine..."
&"C:\Program Files\Oracle\VirtualBox\VBoxManage" controlvm "$machineName" natpf1 "postgres,tcp,,5432,,5432"
echo "Setting ports forwarding finished."
docker-machine env $machineName
&docker-machine env $machineName | Invoke-Expression
}