dziemba / mobymac Goto Github PK
View Code? Open in Web Editor NEWAutomagically install Docker in a VirtualBox VM with super-fast NFS mounts.
License: MIT License
Automagically install Docker in a VirtualBox VM with super-fast NFS mounts.
License: MIT License
It would be nice to have a way to uninstall mobymac. That could be some some section in the README offering guidance for a manual uninstall or an automated script.
Thanks so much for sharing your work! I gave this a try, but after I initially was super happy how well it worked I realised an issue related to watching files that are mounted from the host. I am unsure whether I am simply not using the right mount options or whether what I am trying to do will not work. Our use case is to mount a source directory with -v
on docker run, and having a webpack-dev-server running in the container. Whenever a file is changed in the source directory, the dev server should recompile, which it doesn't.
To reproduce (without webpack-dev-server, just using inotifywait
):
test.txt
test text
test.sh
#!/bin/sh
while inotifywait test.txt; do
echo "file changed"
done
Dockerfile
FROM ubuntu:18.04
RUN apt-get update -qq && apt-get install -qq -y --no-install-recommends \
inotify-tools
WORKDIR /home
CMD chmod +x test.sh && ./test.sh
docker build -t mobytest .
docker run -it --rm -v $(pwd):/home mobytest:latest
--> watches should be established, leave openecho "host waz here" > test.txt
--> no file change detected, cat test.txt
in container shows change has in fact been madeecho "docker waz here" > test.txt
--> file change detectedWhat I have tried
docker-machine-nfs ${VMNAME} --mount-opts="noacl,async,noatime,actimeo=1,nfsvers=3"
(same as from install.sh)docker-machine-nfs ${VMNAME} --mount-opts="noacl,async,nolock,vers=3,udp,noatime,actimeo=2"
(from this article)async
optionsync
optionany help would be greatly appreciated :)
If Docker for Mac (native) doesn't exist on the machine, the script outputs:
=== Uninstalling Docker for Mac (native)...
./install.sh: line 166: /Applications/Docker.app/Contents/MacOS/Docker: No such file or directory
+===============================================+
| ERRORS FOUND |
| Inspect logs and ask for assistance if needed |
+===============================================+
For troubleshooting help, go to:
https://github.com/dziemba/mobymac#troubleshooting
Let the script continue whether or not Docker for Mac exists.
When installing for the first time on macOS Mojave, VirtualBox fails to install because the system refuses to load the kernel extension:
Error: Failure while executing; `/usr/bin/sudo -E -- env LOGNAME=mr USER=mr USERNAME=mr /usr/sbin/installer -pkg /usr/local/Caskroom/virtualbox/5.2.22,126460/VirtualBox.pkg -target /` exited with 1. Here's the output:
installer: Package name is Oracle VM VirtualBox
installer: Installing at base path /
installer: The install failed (The Installer encountered an error that caused the installation to fail. Contact the software manufacturer for assistance.)
At this time, a pop-up appears notifying that an extension was blocked. After allowing it in the Security preference pane, the second installation runs into
(default) Creating a new host-only adapter produced an error: /usr/local/bin/VBoxManage hostonlyif create failed:
(default) 0%...
(default) Progress state: NS_ERROR_FAILURE
(default) VBoxManage: error: Failed to create the host-only adapter
(default) VBoxManage: error: VBoxNetAdpCtl: Error while adding new interface: failed to open /dev/vboxnetctl: No such file or directory
(default) VBoxManage: error: Details: code NS_ERROR_FAILURE (0x80004005), component HostNetworkInterfaceWrap, interface IHostNetworkInterface
(default) VBoxManage: error: Context: "RTEXITCODE handleCreate(HandlerArg *)" at line 94 of file VBoxManageHostonly.cpp
(default)
(default) This is a known VirtualBox bug. Let's try to recover anyway...
Error creating machine: Error in driver during machine creation: Error setting up host only network on machine start: The host-only adapter we just created is not visible. This is a well known VirtualBox bug. You might want to uninstall it and reinstall at least version 5.0.12 that is is supposed to fix this issue
Open VirtualBox, delete the "default" VM, then run the installer again.
Allow the extension, then reboot, then run the installer again.
[I] ~/s/g/d/mobymac (master|✔) [130] $ ./install.sh fish ========= mobymac =========Creating docker v18.06.1-ce VM with 4096MB RAM and fish shell integration
WARNING: this will uninstall docker4mac and destroy all existing docker data
Press CTRL-C to abort (sleeping for 5 seconds)=== Uninstalling Docker for Mac...
=== Not found - skipping=== Installing Virtualbox...
Updating Homebrew...
==> Auto-updated Homebrew!
Updated 1 tap (homebrew/cask).
No changes to formulae.==> Caveats
To install and/or use virtualbox you may need to enable their kernel extension inSystem Preferences → Security & Privacy → General
For more information refer to vendor documentation or the Apple Technical Note:
https://developer.apple.com/library/content/technotes/tn2459/_index.html
==> Satisfying dependencies
==> Downloading https://download.virtualbox.org/virtualbox/5.2.22/VirtualBox-5.2.22-126460-OSX.dmg
######################################################################## 100.0%
==> Verifying SHA-256 checksum for Cask 'virtualbox'.
==> Installing Cask virtualbox
==> Running installer for virtualbox; your password may be necessary.
==> Package installers may write to any location; options such as --appdir are ignored.
Password:
installer: Package name is Oracle VM VirtualBox
installer: Installing at base path /
installer: The install failed (The Installer encountered an error that caused the installation to fail. Contact the software manufacturer for assistance.)
==> Purging files for version 5.2.22,126460 of Cask virtualbox
Error: Failure while executing;/usr/bin/sudo -E -- env LOGNAME=mr USER=mr USERNAME=mr /usr/sbin/installer -pkg /usr/local/Caskroom/virtualbox/5.2.22,126460/VirtualBox.pkg -target /
exited with 1. Here's the output:
installer: Package name is Oracle VM VirtualBox
installer: Installing at base path /
installer: The install failed (The Installer encountered an error that caused the installation to fail. Contact the software manufacturer for assistance.)Follow the instructions here:
https://github.com/Homebrew/homebrew-cask#reporting-bugs
/usr/local/Homebrew/Library/Homebrew/system_command.rb:107:inassert_success' /usr/local/Homebrew/Library/Homebrew/system_command.rb:50:in
run!'
/usr/local/Homebrew/Library/Homebrew/system_command.rb:27:inrun' /usr/local/Homebrew/Library/Homebrew/system_command.rb:31:in
run!'
/usr/local/Homebrew/Library/Homebrew/cask/artifact/pkg.rb:59:inblock in run_installer' /usr/local/Homebrew/Library/Homebrew/cask/artifact/pkg.rb:65:in
with_choices_file'
/usr/local/Homebrew/Library/Homebrew/cask/artifact/pkg.rb:52:inrun_installer' /usr/local/Homebrew/Library/Homebrew/cask/artifact/pkg.rb:32:in
install_phase'
/usr/local/Homebrew/Library/Homebrew/cask/installer.rb:209:inblock in install_artifacts' /System/Library/Frameworks/Ruby.framework/Versions/2.3/usr/lib/ruby/2.3.0/set.rb:674:in
each'
/System/Library/Frameworks/Ruby.framework/Versions/2.3/usr/lib/ruby/2.3.0/set.rb:674:ineach' /usr/local/Homebrew/Library/Homebrew/cask/installer.rb:200:in
install_artifacts'
/usr/local/Homebrew/Library/Homebrew/cask/installer.rb:95:ininstall' /usr/local/Homebrew/Library/Homebrew/cask/cmd/install.rb:21:in
block in run'
/usr/local/Homebrew/Library/Homebrew/cask/cmd/install.rb:14:ineach' /usr/local/Homebrew/Library/Homebrew/cask/cmd/install.rb:14:in
run'
/usr/local/Homebrew/Library/Homebrew/cask/cmd/abstract_command.rb:34:inrun' /usr/local/Homebrew/Library/Homebrew/cask/cmd.rb:89:in
run_command'
/usr/local/Homebrew/Library/Homebrew/cask/cmd.rb:155:inrun' /usr/local/Homebrew/Library/Homebrew/cask/cmd.rb:120:in
run'
/usr/local/Homebrew/Library/Homebrew/cmd/cask.rb:7:incask' /usr/local/Homebrew/Library/Homebrew/brew.rb:89:in
'
[I] ~/s/g/d/mobymac (master|✔) [1] $ ./install.sh fishmobymac
Creating docker v18.06.1-ce VM with 4096MB RAM and fish shell integration
WARNING: this will uninstall docker4mac and destroy all existing docker data
Press CTRL-C to abort (sleeping for 5 seconds)=== Uninstalling Docker for Mac...
=== Not found - skipping=== Installing Virtualbox...
=== Already installed - skipping=== Removing old docker packages...
===> OK=== Installing docker packages...
Updating Homebrew...
==> Auto-updated Homebrew!
Updated 1 tap (homebrew/cask).
No changes to formulae.==> Downloading https://homebrew.bintray.com/bottles/docker-18.09.0.mojave.bottle.tar.gz
==> Downloading from https://akamai.bintray.com/fd/fd7f17039daf874ced54a20a4d0b285cebcc35edf547a6ac62a5beb6c4c05326?__gda__=exp=1542973329~hmac=941786fcfb688c68ddbd537a9060a960ae786
######################################################################## 100.0%
==> Pouring docker-18.09.0.mojave.bottle.tar.gz
==> Caveats
Bash completion has been installed to:
/usr/local/etc/bash_completion.dzsh completions have been installed to:
/usr/local/share/zsh/site-functionsfish completions have been installed to:
/usr/local/share/fish/vendor_completions.d
==> Summary
🍺 /usr/local/Cellar/docker/18.09.0: 8 files, 48.9MB
==> Installing dependencies for docker-compose: libyaml, gdbm, openssl, readline, sqlite, xz and python
==> Installing docker-compose dependency: libyaml
==> Downloading https://homebrew.bintray.com/bottles/libyaml-0.2.1.mojave.bottle.tar.gz
######################################################################## 100.0%
==> Pouring libyaml-0.2.1.mojave.bottle.tar.gz
🍺 /usr/local/Cellar/libyaml/0.2.1: 9 files, 299.3KB
==> Installing docker-compose dependency: gdbm
==> Downloading https://homebrew.bintray.com/bottles/gdbm-1.18.1.mojave.bottle.tar.gz
######################################################################## 100.0%
==> Pouring gdbm-1.18.1.mojave.bottle.tar.gz
🍺 /usr/local/Cellar/gdbm/1.18.1: 20 files, 591.2KB
==> Installing docker-compose dependency: openssl
==> Downloading https://homebrew.bintray.com/bottles/openssl-1.0.2p.mojave.bottle.tar.gz
==> Downloading from https://akamai.bintray.com/ca/cabda4ca62a0b206366658e36ce7175e7da5f8ad24846843611ed19d7759404b?__gda__=exp=1542973337~hmac=a42bba2397da400b8d9e3f0d622260b243cd7
######################################################################## 100.0%
==> Pouring openssl-1.0.2p.mojave.bottle.tar.gz
==> Caveats
A CA file has been bootstrapped using certificates from the SystemRoots
keychain. To add additional certificates (e.g. the certificates added in
the System keychain), place .pem files in
/usr/local/etc/openssl/certsand run
/usr/local/opt/openssl/bin/c_rehashopenssl is keg-only, which means it was not symlinked into /usr/local,
because Apple has deprecated use of OpenSSL in favor of its own TLS and crypto libraries.If you need to have openssl first in your PATH run:
echo 'set -g fish_user_paths "/usr/local/opt/openssl/bin" $fish_user_paths' >> ~/.config/fish/config.fishFor compilers to find openssl you may need to set:
set -gx LDFLAGS "-L/usr/local/opt/openssl/lib"
set -gx CPPFLAGS "-I/usr/local/opt/openssl/include"==> Summary
🍺 /usr/local/Cellar/openssl/1.0.2p: 1,793 files, 12MB
==> Installing docker-compose dependency: readline
==> Downloading https://homebrew.bintray.com/bottles/readline-7.0.5.mojave.bottle.tar.gz
==> Downloading from https://akamai.bintray.com/59/5976a79f0dbd5ccb2a261f692763319d612309caa2b8cf703f209270764c657c?__gda__=exp=1542973345~hmac=8cc9fa7922afaf08f372928727be8c014d984
######################################################################## 100.0%
==> Pouring readline-7.0.5.mojave.bottle.tar.gz
==> Caveats
readline is keg-only, which means it was not symlinked into /usr/local,
because macOS provides the BSD libedit library, which shadows libreadline.
In order to prevent conflicts when programs look for libreadline we are
defaulting this GNU Readline installation to keg-only.For compilers to find readline you may need to set:
set -gx LDFLAGS "-L/usr/local/opt/readline/lib"
set -gx CPPFLAGS "-I/usr/local/opt/readline/include"==> Summary
🍺 /usr/local/Cellar/readline/7.0.5: 46 files, 1.5MB
==> Installing docker-compose dependency: sqlite
==> Downloading https://homebrew.bintray.com/bottles/sqlite-3.25.3.mojave.bottle.tar.gz
==> Downloading from https://akamai.bintray.com/6e/6e6e8e439db5458beba5ed5eedd45650f1db85709df6902e8be8a3853077eb65?__gda__=exp=1542973347~hmac=fa75bc6295dedd20d2b3a9523bb9efd37536c
######################################################################## 100.0%
==> Pouring sqlite-3.25.3.mojave.bottle.tar.gz
==> Caveats
sqlite is keg-only, which means it was not symlinked into /usr/local,
because macOS provides an older sqlite3.If you need to have sqlite first in your PATH run:
echo 'set -g fish_user_paths "/usr/local/opt/sqlite/bin" $fish_user_paths' >> ~/.config/fish/config.fishFor compilers to find sqlite you may need to set:
set -gx LDFLAGS "-L/usr/local/opt/sqlite/lib"
set -gx CPPFLAGS "-I/usr/local/opt/sqlite/include"==> Summary
🍺 /usr/local/Cellar/sqlite/3.25.3: 11 files, 3.7MB
==> Installing docker-compose dependency: xz
==> Downloading https://homebrew.bintray.com/bottles/xz-5.2.4.mojave.bottle.tar.gz
==> Downloading from https://akamai.bintray.com/01/010667293df282c8bceede3bcd36953dd57c56cef608d09a5b50694ab7d4b96b?__gda__=exp=1542973349~hmac=efed92a823f0d9abe5889c097f39e93ed271b
######################################################################## 100.0%
==> Pouring xz-5.2.4.mojave.bottle.tar.gz
🍺 /usr/local/Cellar/xz/5.2.4: 92 files, 1MB
==> Installing docker-compose dependency: python
==> Downloading https://homebrew.bintray.com/bottles/python-3.7.1.mojave.bottle.tar.gz
==> Downloading from https://akamai.bintray.com/5c/5cc9c4b87eb68c2b2f491cf907ee4517279bfc2c4e41c366ef994aebff7e9684?__gda__=exp=1542973354~hmac=adb31ab5faf88b4f5e629492cc910824782e6
######################################################################## 100.0%
==> Pouring python-3.7.1.mojave.bottle.tar.gz
==> /usr/local/Cellar/python/3.7.1/bin/python3 -s setup.py --no-user-cfg install --force --verbose --install-scripts=/usr/local/Cellar/python/3.7.1/bin --install-lib=/usr/local/lib/
==> /usr/local/Cellar/python/3.7.1/bin/python3 -s setup.py --no-user-cfg install --force --verbose --install-scripts=/usr/local/Cellar/python/3.7.1/bin --install-lib=/usr/local/lib/
==> /usr/local/Cellar/python/3.7.1/bin/python3 -s setup.py --no-user-cfg install --force --verbose --install-scripts=/usr/local/Cellar/python/3.7.1/bin --install-lib=/usr/local/lib/
==> Caveats
Python has been installed as
/usr/local/bin/python3Unversioned symlinks
python
,python-config
,pip
etc. pointing to
python3
,python3-config
,pip3
etc., respectively, have been installed into
/usr/local/opt/python/libexec/binIf you need Homebrew's Python 2.7 run
brew install python@2You can install Python packages with
pip3 install
They will install into the site-package directory
/usr/local/lib/python3.7/site-packagesSee: https://docs.brew.sh/Homebrew-and-Python
==> Summary
🍺 /usr/local/Cellar/python/3.7.1: 3,820 files, 59.2MB
==> Installing docker-compose
==> Downloading https://homebrew.bintray.com/bottles/docker-compose-1.23.1.mojave.bottle.tar.gz
==> Downloading from https://akamai.bintray.com/e0/e0ff1f3b92d2a5988ad5b189845eed2365488858caad420a4987870975e9d157?__gda__=exp=1542973375~hmac=57610e89cf947fa7fd3712276e709955fe671
######################################################################## 100.0%
==> Pouring docker-compose-1.23.1.mojave.bottle.tar.gz
==> Caveats
Bash completion has been installed to:
/usr/local/etc/bash_completion.dzsh completions have been installed to:
/usr/local/share/zsh/site-functions
==> Summary
🍺 /usr/local/Cellar/docker-compose/1.23.1: 892 files, 9MB
==> Downloading https://homebrew.bintray.com/bottles/docker-machine-0.16.0.mojave.bottle.tar.gz
==> Downloading from https://akamai.bintray.com/9a/9aec00d16a4a501a17247b170739f23e66f0c86a3d0543bc65419bf4463b2431?__gda__=exp=1542973382~hmac=c8c57033fc3369d3b44a660823f7983cbb7d5
######################################################################## 100.0%
==> Pouring docker-machine-0.16.0.mojave.bottle.tar.gz
==> Caveats
Bash completion has been installed to:
/usr/local/etc/bash_completion.dzsh completions have been installed to:
/usr/local/share/zsh/site-functionsTo have launchd start docker-machine now and restart at login:
brew services start docker-machine
Or, if you don't want/need a background service you can just run:
docker-machine start
==> Summary
🍺 /usr/local/Cellar/docker-machine/0.16.0: 11 files, 35.7MB
==> Downloading https://github.com/adlogix/docker-machine-nfs/archive/0.5.1.tar.gz
==> Downloading from https://codeload.github.com/adlogix/docker-machine-nfs/tar.gz/0.5.1
######################################################################## 100.0%
🍺 /usr/local/Cellar/docker-machine-nfs/0.5.1: 5 files, 18.4KB, built in 6 seconds
==> Caveats
==> docker
Bash completion has been installed to:
/usr/local/etc/bash_completion.dzsh completions have been installed to:
/usr/local/share/zsh/site-functionsfish completions have been installed to:
/usr/local/share/fish/vendor_completions.d
==> openssl
A CA file has been bootstrapped using certificates from the SystemRoots
keychain. To add additional certificates (e.g. the certificates added in
the System keychain), place .pem files in
/usr/local/etc/openssl/certsand run
/usr/local/opt/openssl/bin/c_rehashopenssl is keg-only, which means it was not symlinked into /usr/local,
because Apple has deprecated use of OpenSSL in favor of its own TLS and crypto libraries.If you need to have openssl first in your PATH run:
echo 'set -g fish_user_paths "/usr/local/opt/openssl/bin" $fish_user_paths' >> ~/.config/fish/config.fishFor compilers to find openssl you may need to set:
set -gx LDFLAGS "-L/usr/local/opt/openssl/lib"
set -gx CPPFLAGS "-I/usr/local/opt/openssl/include"==> readline
readline is keg-only, which means it was not symlinked into /usr/local,
because macOS provides the BSD libedit library, which shadows libreadline.
In order to prevent conflicts when programs look for libreadline we are
defaulting this GNU Readline installation to keg-only.For compilers to find readline you may need to set:
set -gx LDFLAGS "-L/usr/local/opt/readline/lib"
set -gx CPPFLAGS "-I/usr/local/opt/readline/include"==> sqlite
sqlite is keg-only, which means it was not symlinked into /usr/local,
because macOS provides an older sqlite3.If you need to have sqlite first in your PATH run:
echo 'set -g fish_user_paths "/usr/local/opt/sqlite/bin" $fish_user_paths' >> ~/.config/fish/config.fishFor compilers to find sqlite you may need to set:
set -gx LDFLAGS "-L/usr/local/opt/sqlite/lib"
set -gx CPPFLAGS "-I/usr/local/opt/sqlite/include"==> python
Python has been installed as
/usr/local/bin/python3Unversioned symlinks
python
,python-config
,pip
etc. pointing to
python3
,python3-config
,pip3
etc., respectively, have been installed into
/usr/local/opt/python/libexec/binIf you need Homebrew's Python 2.7 run
brew install python@2You can install Python packages with
pip3 install
They will install into the site-package directory
/usr/local/lib/python3.7/site-packagesSee: https://docs.brew.sh/Homebrew-and-Python
==> docker-compose
Bash completion has been installed to:
/usr/local/etc/bash_completion.dzsh completions have been installed to:
/usr/local/share/zsh/site-functions
==> docker-machine
Bash completion has been installed to:
/usr/local/etc/bash_completion.dzsh completions have been installed to:
/usr/local/share/zsh/site-functionsTo have launchd start docker-machine now and restart at login:
brew services start docker-machine
Or, if you don't want/need a background service you can just run:
docker-machine start
===> OK=== Removing existing VMs...
About to remove default
WARNING: This action will delete both local reference and remote instance.
Error removing host "default": Docker machine "default" does not exist. Use "docker-machine ls" to list machines. Use "docker-machine create" to add a new one.
Can't remove "default"
===> OK=== Creating docker VM...
Creating CA: /Users/mr/.docker/machine/certs/ca.pem
Creating client certificate: /Users/mr/.docker/machine/certs/cert.pem
Running pre-create checks...
(default) Image cache directory does not exist, creating it at /Users/mr/.docker/machine/cache...
Creating machine...
(default) Downloading /Users/mr/.docker/machine/cache/boot2docker.iso from https://github.com/boot2docker/boot2docker/releases/download/v18.06.1-ce/boot2docker.iso...
(default) 0%....10%....20%....30%....40%....50%....60%....70%....80%....90%....100%
(default) Creating VirtualBox VM...
(default) Creating SSH key...
(default) Starting the VM...
(default) Check network to re-create if needed...
(default) Creating a new host-only adapter produced an error: /usr/local/bin/VBoxManage hostonlyif create failed:
(default) 0%...
(default) Progress state: NS_ERROR_FAILURE
(default) VBoxManage: error: Failed to create the host-only adapter
(default) VBoxManage: error: VBoxNetAdpCtl: Error while adding new interface: failed to open /dev/vboxnetctl: No such file or directory
(default) VBoxManage: error: Details: code NS_ERROR_FAILURE (0x80004005), component HostNetworkInterfaceWrap, interface IHostNetworkInterface
(default) VBoxManage: error: Context: "RTEXITCODE handleCreate(HandlerArg *)" at line 94 of file VBoxManageHostonly.cpp
(default)
(default) This is a known VirtualBox bug. Let's try to recover anyway...
Error creating machine: Error in driver during machine creation: Error setting up host only network on machine start: The host-only adapter we just created is not visible. This is a well known VirtualBox bug. You might want to uninstall it and reinstall at least version 5.0.12 that is is supposed to fix this issue
Just curious if anyone would consider or is interested in a configuration whereby the VM running docker engine is accessed through port mapping (e.g., 127.0.0.1:2375) instead of a separate IP on a internal-network subnet (e.g., 192.168.42.2:2375 given the default subnet of 192.168.42.0/24).
A use case for this would be people on corporate VPN connections. Often a VPN client forces all non-whitelisted subnets to be routed through the VPN tunnel - thereby making it impossible to route to a VM on the non-whitelisted internal network subnet.
The downside of such an approach is that port mappings to running containers on the VM could become cumbersome to manage. I don't have a great solution for that one at this time.
Thoughts?
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.