Reno, NV    +1 (800)0 621-0871

Go back

Development

Five Steps to Setup a Docker Development Environment in OS X

  |  July 7, 2014

Several weeks ago, I gave up on using boot2docker in favor of using DigitalOcean droplets. This time, I gave boot2docker another try because it had just released version 1.1.0 (same as Docker’s). This version fixes the problem I had with forwarding ports.

This tutorial will show you how to install boot2docker-cli and be able to send commands to a Docker daemon running on a virtual machine. Also, I’m assuming you’ve installed Go in your Mac.

  • Install docker client and boot2docker-cli:
      $ brew install docker
    $ go get github.com/boot2docker/boot2docker-cli
    
  • (recommended) Symlink boot2docker-cli:

    $ ln -s $GOPATH/bin/boot2docker-cli $GOPATH/bin/boot2docker
    As of this writing, I ran boot2docker version and it did not show the version information.

  • Create the virtual machine:

    $ boot2docker init

  • Boot up the virtual machine:

    $ boot2docker up
    If you’re running this command for the first time, boot2docker you will need to export $DOCKER_HOST to point to the VM.

  • Verify (see screenshot):

    $ boot2docker ssh
    Screenshot 2014-07-06 18.31.32

boot2docker-cli creates two network interfaces (one will be used for NAT and another will be used for port forwarding on a private network):

Screenshot 2014-07-06 18.32.11