This formula resolves the Docker issue on AMD based MacOS (Ryzentosh). Also can be used on any Mac.
PLEASE READ FIRST THE NOTICE: https://gist.github.com/slykar/e92732be9bf81a71e08068245656d70e?permalink_comment_id=4105556#gistcomment-4105556
https://www.virtualbox.org/wiki/Downloads.
Please don't forget to remove all previous installations.
This step required only if you want to use VirtualBox driver, otherwise see below how to start with another driver.
Due the changes of virtualbox networking, you need to allow docker-machine host in order to use 192.168.99.0/8 network. More Details
Add this line into
/etc/vbox/networks.conf
* 192.168.99.0/8
brew tap sergeycherepanov/docker-virtualbox
brew install docker-virtualbox
WARNING: Only this commands requires root permissions, all next should be run under your user
Ensure the NFS exports file exists
sudo touch /etc/exports
Allow the staff group to configure NFS shares and run the balancer without a password prompt
sudo tee /etc/sudoers.d/docker-machine-nfs <<SUDOERS
%staff ALL=(ALL) NOPASSWD: /sbin/nfsd
%staff ALL=(ALL) NOPASSWD: /bin/cp /etc/nfs.conf /etc/nfs.conf.bak
%staff ALL=(ALL) NOPASSWD: /usr/bin/tee /etc/exports
%staff ALL=(ALL) NOPASSWD: /usr/bin/tee /etc/nfs.conf
%staff ALL=(ALL) NOPASSWD: $(brew --prefix)/opt/docker-virtualbox/bin/gobetween
SUDOERS
Reboot your system to be sure that sudoers applied
If you didn't install Docker for Mac you can link binaries instead of PATH update
brew link --force --overwrite docker-virtualbox
Otherwise configure the PATH variable
# For the bash
echo "export PATH=\"$(brew --prefix docker-virtualbox)/bin:\$PATH\"" >> ~/.bash_profile
# For the zsh
echo "export PATH=\"$(brew --prefix docker-virtualbox)/bin:\$PATH\"" >> ~/.zshrc
Reload the shell
exec $SHELL
In the first run according to the permissions policy you need to run it manually and approve permissions.
docker-machine-init initialize
This is will download, create and configure the VirtualBox-based machine if the machine was not configured before. If the machine was created manually this will only set up NFS mount.
When initialization will be finished you are ready to enable the service
The log file will be always available in
/tmp/docker-virtualbox.log
.
brew services start docker-virtualbox
Test the Docker by running Nginx
docker run -d -p 8989:80 nginx
curl -v localhost:8989
If you don't want to use the VirtualBox as docker-machine driver you need to create a machine manually before initialization by similar command:
docker-machine create --driver generic --generic-ip-address=192.168.24.108 --generic-ssh-user=developer --generic-ssh-key=$HOME/.ssh/id_rsa docker
Please note the docker-machine-nfs plugin supports only Debian based Linux as the target system. For more information read the documentation
Read the log when the docker doesn't work properly
tail -n 1000 -f /tmp/docker-virtualbox.log
SSH connection to the docker-machine
docker-machine ssh docker
To stop the service just run
brew services stop docker-virtualbox
To setup environment for 3rd party tools (ctop
as example)
source /tmp/docker-virtualbox.env
source /tmp/docker-virtualbox-machine.env
- The system won't sleep when the NFS server runs
- The port forwarding doesn't work for UDP proto (improvement needed)