Boot2docker setup on Mac OS X

Boot2docker is officially deprecated. Use Docker for Mac if Mac OS X version is 10.10.3 or newer running on a 2010 or newer Mac, with Intel’s hardware support for MMU virtualization; use Docker Toolbox if software or hardware requirements are not met.

Check out Docker for Mac vs. Docker Toolbox to understand the differences.

  • Install Boot2Docker package (I have installed Boot2Docker-1.7.0.pkg)
  • Start instance sharing folder /users/sdevarapalli/learning/docker as “shared”
    ws@sdevarapalli:~> boot2docker --vbox-share="/users/sdevarapalli/learning/docker=shared" up
    
  • Set up environment variables
    ws@sdevarapalli:~> eval "$(boot2docker shellinit)"
    Writing /Users/sdevarapalli/.boot2docker/certs/boot2docker-vm/ca.pem
    Writing /Users/sdevarapalli/.boot2docker/certs/boot2docker-vm/cert.pem
    Writing /Users/sdevarapalli/.boot2docker/certs/boot2docker-vm/key.pem
    ws@sdevarapalli:~> env | grep -i docker
    DOCKER_HOST=tcp://192.168.59.103:2376
    DOCKER_TLS_VERIFY=1
    DOCKER_CERT_PATH=/Users/sdevarapalli/.boot2docker/certs/boot2docker-vm
    
  • Log in to the server
    ws@sdevarapalli:~> boot2docker ssh
     ## .
     ## ## ## ==
     ## ## ## ## ## ===
     /"""""""""""""""""\___/ ===
     ~~~ {~~ ~~~~ ~~~ ~~~~ ~~~ ~ / ===- ~~~
     \______ o __/
     \ \ __/
     \____\_______/
     _ _ ____ _ _
    | |__ ___ ___ | |_|___ \ __| | ___ ___| | _____ _ __
    | '_ \ / _ \ / _ \| __| __) / _` |/ _ \ / __| |/ / _ \ '__|
    | |_) | (_) | (_) | |_ / __/ (_| | (_) | (__| < __/ |
    |_.__/ \___/ \___/ \__|_____\__,_|\___/ \___|_|\_\___|_|
    Boot2Docker version 1.12.0, build HEAD : e030bab - Fri Jul 29 00:29:14 UTC 2016
    Docker version 1.12.0, build 8eab29e
    docker@boot2docker:~$
    
  • To automatically mount the shared folder, add the script bootlocal.sh on the boot2docker host. This script gets executed on VM startup.
    docker@boot2docker:/mnt/sda1/var/lib/boot2docker$ cat bootlocal.sh
    sudo mkdir -p /mnt/shared
    sudo mount -t vboxsf shared /mnt/shared
    docker@boot2docker:/mnt/sda1/var/lib/boot2docker$
    
  • Commands to check status and shutdown:
    ws@sdevarapalli:~> boot2docker status
    running
    ws@ sdevarapalli:~> boot2docker stop
    
Advertisements

One thought on “Boot2docker setup on Mac OS X

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s