Git Product home page Git Product logo

boot2docker-vagrant's Introduction

boot2docker-vagrant

Vagrant based boot2docker box with NFS mounts support for better performance on OSX.
Windows hosts will fall back to the defaukt vboxfs shared folders in Virtualbox.

Requirements

  1. VirtualBox
  2. Vagrant 1.6.3+

TL;DR. How to use.

Copy the Vagrantfile in this repo into your < Projects > (shared boo2docker VM) or < Project > (dedicated boot2docker VM) directory.

$ vagrant up
$ export DOCKER_HOST=tcp://localhost:2375
$ docker version

One-liner for the lazy Mac people (OSX only!)

This installs the following prerequisites and dependencies: brew, cask, virtualbox, vagrant, docker

curl https://raw.githubusercontent.com/blinkreaction/boot2docker-vagrant/master/setup.sh | bash

What is this?

This is a temporary solution to get a better performance with docker data volumes mounted from your OSX host.
Boot2docker currently mounts host volumes via the default VirtualBox Guest Additions (vboxfs) mode, which is terribly slow on OSX. Much better performance can be achieved with NFS.

There is a customzed boot2docker box available on Vagrantcloud which adds support for NFS mounts - yungsang/boot2docker

How does it work?

Vagrant mounts the root directory (were the Vagrantfile is located) via NFS inside the boot2docker VM with the same path as on the host.

/User/<username>/Projects/MyProject on the host => /User/<username>/Projects/MyProject in the boot2docker VM.

Docker containers inside boot2docker can then mount volumes transparently as if they were mounted directry from the host. This is especially important for Fig, which otherwise will not work properly with data volumes on Mac.

See Managing Data in Containers for more infor on data volumes with docker.

Tips

Automate DOCKER_HOST variable export

Add the following in your .bashrc, .zshrc, etc. file to automate the environment variable export:

# Docker (default for Vagrant based boxes)
export DOCKER_HOST=tcp://localhost:2375

If you also have $(boot2docker shellinit) there, then make sure those lines go BEFORE it, e.g.:

# Docker (default for Vagrant based boxes)
export DOCKER_HOST=tcp://localhost:2375

# boot2docker shellinit
$(boot2docker shellinit)

This way if boot2docker is NOT running, your DOCKER_HOST will default to tcp://localhost:2375. Otherwise $(boot2docker shellinit) will overwrite the variables and set DOCKER_HOST to point to the boot2docker VM.

Vagrant control

Vagrant can be controlled (e.g. vagrant up, vagrant ssh, vagrant reload, etc.) from the root directory of the Vagrantfile as well as from any subdirectory. This is very usefull when working with multiple projects in subdirectories.

Sublime Text 3 users

Add this to your user settings (Sublime Text > Preferences > Settings - User):

{
    "atomic_save": false
}

ST3 does not update the ctime extended file attribute when saving a file. This leads to NFS not seeing the changes in a file unless the file size changes as well (i.e. changing a single symbol in a file with ST3 will not be visible over NFS). The setting above fixes that.

boot2docker-vagrant's People

Watchers

James Cloos avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.