Ditching Docker for Desktop on macOS
Docker for Desktop has changed their licensing forcing anyone not willing to pay to go back to the CLI tools. I hit some roadbumps removing the UI and installing the CLI tools. Here’s what I did to overcome them on macOS Big Sur.
Remove the GUI
First, remove the GUI by running the Uninstall in the Troubleshooting section. This is better than dragging the Docker.app to the Trash because it cleans up the LaunchDaemon and other crap.
Install Docker and VirtualBox
Installing the CLI tools for Docker can be done in a bunch of ways but I used brew:
> brew install docker-machine docker virtualbox
The Problem
Next you need to create a docker machine vm and this is where I hit the problem:
> docker-machine create — driver virtualbox default…a bunch of messages…VBoxNetAdpCtl: Error while adding new interface: failed to open /dev/vboxnetctl: No such file or directory
The Solution
The key to the solution is getting VirtualBox to trigger the security exception prompt in macOS. If you don’t Allow the kernel extension for VirtualBox in the General tab of Security in Settings, then the LaunchDaemon won’t load and can’t create the Host adapter. I still don’t know why the the prompt didn’t come up for me but I think it had something to do with having it previously installed.
There are other articles out there but none of them worked for me to force that prompt. In order to force the Allow prompt in the Security Settings, this is what I had to do:
- Reset the security protection configuration
> sudo csrutil clear
2. Clear the kext cache
> sudo kextcache -clear-staging
3. Reboot into Recovery (Hold CMD-R during restart)
4. Open Disk Utility
5. Mount the Hard Disk
6. Close Disk Utility
7. Open the Terminal (still in Recovery)
8. Add the VirtualBox developer as a trusted kernel developer
> /usr/sbin/spctl kext-consent add VB5E2TV963
9. Reboot
At this stage you should see pop-ups telling you that someone has messed with the security configuration. You may also need to reboot again. If you try and run the VirtualBox LaunchDaemon that should trigger the Allow prompt in Settings.
> sudo /Library/Application\ Support/VirtualBox/LaunchDaemons/VirtualBoxStartup.sh restart
Go to System Preferences > Security & Privacy Then hit the “Allow” button to let Oracle (VirtualBox) load.