A great way to get Docker running smoothly on OS X is to use the awesome project Dinghy. It is basically:
Docker on OS X with batteries included, aimed at making a more pleasant local development experience. Runs on top of docker-machine.
Some of the benefits are:
- Faster volume sharing using NFS rather than built-in virtualbox/vmware file shares
- Filesystem events work on mounted volumes
- Easy access to running containers using built-in DNS and HTTP proxy
Since OS X is Unix-based, you'll need to add some additional pieces of functionality to be able to run Docker on your Mac.
brew tap caskroom/cask
brew update
brew install docker docker-compose
brew cask install virtualbox virtualbox-extension-pack
brew tap codekitchen/dinghy
brew install dinghy
The next step is to create the dinghy
VM. This creates a VM that is based on VirtualBox and Docker Machine. Please note it will take a few minutes for this command to complete:
dinghy create --provider virtualbox
After a successful VM creation, you'll receive shell output similar to the following:
export DOCKER_HOST=tcp://192.168.99.101:2376
export DOCKER_CERT_PATH=/Users/prm/.docker/machine/machines/dinghy
export DOCKER_TLS_VERIFY=1
export DOCKER_MACHINE_NAME=dinghy
Be sure to add these lines to your ~/.bash_profile
or similar file. Also, don't copy/paste the above because these lines change for each specific install.
Dinghy and the VM can be upgraded separately.
Upgrade Dinghy:
dinghy halt
brew update
brew upgrade dinghy
dinghy up
Upgrade the Dinghy VM:
dinghy upgrade
You may now test the installation. An easy way is to run:
docker ps