mirror of
https://github.com/lloeki/dotfiles.git
synced 2025-12-06 07:24:39 +01:00
Autodetect and autostart Docker Fusion VM
This commit is contained in:
parent
be65b905f9
commit
1dd9a5184e
1 changed files with 19 additions and 6 deletions
25
shell/docker
25
shell/docker
|
|
@ -1,10 +1,23 @@
|
||||||
#export DOCKER_HOST=tcp://172.16.63.96:4243
|
if [[ "${OSTYPE}" == *darwin* ]]; then
|
||||||
|
vmrun='/Applications/VMware Fusion.app/Contents/Library/vmrun'
|
||||||
|
docker_vmx="${HOME}/Virtual Machines.localized/Docker.vmwarevm/Docker.vmx"
|
||||||
|
|
||||||
#export DOCKER_TLS_VERIFY="1"
|
if [[ -f "${vmrun}" && -f "${docker_vmx}" ]]; then
|
||||||
#export DOCKER_HOST="tcp://172.16.71.132:2376"
|
if "${vmrun}" list | grep -q "${docker_vmx}"; then
|
||||||
#export DOCKER_CERT_PATH="/Users/lloeki/.docker/machine/machines/default"
|
:
|
||||||
#export DOCKER_MACHINE_NAME="default"
|
else
|
||||||
|
# TODO: user feedback facilities
|
||||||
|
echo "* Starting Docker VM"
|
||||||
|
"${vmrun}" start "${docker_vmx}" nogui
|
||||||
|
fi
|
||||||
|
|
||||||
#export DOCKER_HOST=ssh://172.16.50.2
|
# TODO: make this faster
|
||||||
|
# - look into /var/db/vmware/vmnet-dhcpd-vmnet{1,8}.leases
|
||||||
|
# - cache found IP
|
||||||
|
docker_vm_ip="$("${vmrun}" getGuestIPAddress "${docker_vmx}" -wait)"
|
||||||
|
|
||||||
|
export DOCKER_HOST="ssh://docker@${docker_vm_ip}"
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
|
||||||
# vim: ft=bash
|
# vim: ft=bash
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue