Installing docker on Mac

This post provides some quick steps to install Docker on a Mac

1. Install Virtual box

Follow instruction from this link to install Virtual box first

2. Install boot2docker and docker

Go to the official Docker site to install, or from homebrew. This instruction is for those who want to use homebrew:

Note: Make sure you have hombrew installed upfront, if not, do below steps first:

– Install Xcode from Apple App Store

– Install necessary utilities from Apple:

$xcode-select install

Once you have the utilities which include curl, run the command below:

$ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"

Now you have brew, run:

$brew update
$brew install docker
$brew install boot2docker

3. Initiate boot2docker

$boot2docker init

then

$boot2docker start

3. Set necessary environments variables

$export DOCKER_HOST=tcp://192.168.2.144:2375

Note: The ip address above should be different for your environment. Take what `boot2docker up` command recommends. 

Troubles shooting:

  1. error in run: Failed to initialize machine “boot2docker-vm”: exit status 1

Run $boot2docker init -v for details

In many cases, it’s because permission problem. Try to delete this file /path/to/boot2docker-vm/boot2docker-vm.vbox then try again

  1. docker-machine create hangs at: Daemon not responding yet: dial tcp your_specific_ip: operation timed out

That’s Virtualbox problem, the latest test version (5.0.3) solves this issue.

Leave a comment