Tag Archives: docker

Share a folder from a host Mac OS to a VirtualBox Linux guest

If you’re using VirtualBox to run a VM on your Mac OS, you may already see that the /Users folder of the Mac is by default shared to the guest system. But you may need to share a different folder of the host Mac OS to the guest. In that case, follow these quick steps:

– In VirtualBox, select the VM instance of the guest system then click on Settings

– Click on Shared Folders icon

– Add a new item for Machine Folders list

– In Folder Path, enter or Click on the dropdown list to browse the folder of the Mac OS you want to share. Eg: <host-folder-path>

– In the Folder Name box, enter the name for that folder. Eg: <host-folder>

– Check Auto-mount and Make Permanent boxes

– SSH to the Linux guest system. Eg: If you’re using docker machine:

$ docker-machine ssh default (default is the name of the VM)

– Create a folder on the guest system:

$ mkdir -p /path/on/guest 

– Then do the mount:

 $ sudo mount -t vboxsf <host-folder> /path/on/guest 

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


$boot2docker start

3. Set necessary environments variables

$export DOCKER_HOST=tcp://

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.