Skip to content

Instantly share code, notes, and snippets.

@cmitz
Created October 4, 2021 15:08
Show Gist options
  • Save cmitz/ead9709f63285ee70ffaf264ad19f124 to your computer and use it in GitHub Desktop.
Save cmitz/ead9709f63285ee70ffaf264ad19f124 to your computer and use it in GitHub Desktop.
Installing/using Docker on MacOS without Docker.app

Setup Docker for macOS without Docker.app (the default GUI)

Since the Docker app for macOS is not free to use anymore for companies, I looked into running "bare" docker-machine. This runs the "Docker engine" (?) in a Linux VirtualBox VM, managed by docker-machine.

Prerequisites

  1. VirtualBox
  2. Homebrew
    1. If installed, update your packages with brew update & brew upgrade
    2. Or install via Homebrew
  3. No Docker.app (remove Docker.app from ~/Applications)
  4. No ~/.docker folder

Installation

  1. brew install docker docker-machine docker-compose
  2. docker-machine create —driver=virtualbox default
    1. If that fails, open macOS system /Security & Privacy/
    2. Unlock if neccessary
    3. Press allow /Oracle VM VirtualBox Manager/ system extension
    4. Reboot
    5. Remove VM named default from Vm VirtualBox Mamager
    6. Remove ~/.docker folder
    7. Repeat step 2
  3. Profit?

Sources

  1. Docker Machine Overview | Docker Documentation
  2. Docker can’t connect to docker daemon - Stack Overflow

Problems

  • Applications can't access docker network out-of-the-box so a custom setup is required.
  • Port forwarding is not straight forward.
  • Application configs (database.yml and redis URLs) may require changes to support both Docker.app and VirtualBox setup
  • Incompatible with M1 machines
    • Or more precisely, requires Docker Daemon API 1.40 or lower which does not support the platform: linux/x86_64 key/value in docker-compose
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment