First, install VirtualBox. Then:
brew update
brew upgrade
brew install docker boot2docker
mkdir ~/.boot2docker
curl http://static.dockerfiles.io/boot2docker-v1.1.2-virtualbox-guest-additions-v4.3.12.iso \
> ~/.boot2docker/boot2docker.iso
# (get the URL of the latest ISO at
# https://medium.com/boot2docker-lightweight-linux-for-docker/boot2docker-together-with-virtualbox-guest-additions-da1e3ab2465c)
boot2docker init
VBoxManage sharedfolder add boot2docker-vm --name home --hostpath /Users --readonly
echo 'export DOCKER_HOST=tcp://$(boot2docker ip 2>/dev/null):2375' \
>> ~/.profile
# or if you're using fish:
# echo 'set -x DOCKER_HOST tcp://(boot2docker ip 2>/dev/null):2375' \
# >> ~/.config/fish/config.fish