Skip to content
This repository has been archived by the owner on Aug 31, 2021. It is now read-only.

dduportal/boot2docker-vagrant-box

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

boot2docker Vagrant Box

This repository contains the scripts necessary to create a Vagrant-compatible boot2docker box.

If you work solely with Docker, this box lets you keep your Vagrant workflow and work in the most minimal Docker environment possible.

Usage

The box is available on Hashicorp's Atlas, making it very easy to use it:

$ vagrant init dduportal/boot2docker
$ vagrant up

Tips & tricks

  • Vagrant synced folder has been tested with :
    • Shared Folder for Virtualbox and Parallels Desktop: This is default sharing system

    • rsync : add this line to your Vagrantfile (it will overwrite the default vboxsf sync behaviour) :

config.vm.synced_folder ".", "/vagrant", type: "rsync" ```

  • NFS : For now, use environment variable to enable NFS (Mac OS and Linux tested). It will ask for your admin password.

    $ export B2D_NFS_SYNC=1
    $ vagrant up
  • Network considerations :

    • By default, we use a NAT interfaces, which have its ports 2375 and 2376 (Docker IANA ports) forwarded to the loopback (localhost) of your physical host.

    • Also, we provide a private network that allow direct-IP exchange from your host. This is less portable but easier to use. This usage come from the official docker-machine system.

    • If you face problems (Virtualbox errors, IP overlapping, etc.) with the private network, you can disable it with an environment variable :

      $ export B2D_DISABLE_PRIVATE_NETWORK=1
      $ vagrant up
  • If you want to tune contents (custom profile, install tools inside the VM) that do not fit into the "vagrant provisioning" lifecycle combined with the un-persistence of boot2docker, the "bootlocal" system has been extended :

    • The boot2docker FaQ says that you can provide a custom script, named bootlocal.sh to execute things at the end of the boot.
    • We customize in order to run that script from the /vagrant share when mounted, at the end of the boot.
    • So : just place a "bootlocal.sh" script alongside your Vagrantfile to customize what's inside your b2d VM.
  • If you use the VM as a remote Docker daemon in a private networked docker server you need to add in your bootlocal.sh : (Thanks to @Freyskeyd)

# Regenerate certs for the newly created private network IP
sudo /etc/init.d/docker restart
# Copy tls certs to the vagrant share to allow host to use it
sudo cp -r /var/lib/boot2docker/tls /vagrant/

Next, you need to configure your Docker environment :

# For VirtualBox provider:
export DOCKER_CERT_PATH=`pwd`/tls
export DOCKER_HOST=tcp://192.168.10.10:2376
export DOCKER_TLS_VERIFY=1

# For Parallels provider:
export DOCKER_CERT_PATH=`pwd`/tls
export DOCKER_HOST="tcp://`vagrant ssh-config | sed -n "s/[ ]*HostName[ ]*//gp"`:2376"
export DOCKER_TLS_VERIFY=1

Building the Box

If you want to recreate the box, rather than using the binary, then you can use the scripts and Packer template within this repository to do so in seconds.

To build the box, first install the following prerequisites:

Then run this command to build the box for VirtualBox provider:

make virtualbox

or this one to build the box for Parallels provider:

make parallels

About

Packer scripts to build a Vagrant-compatible boot2docker box.

Resources

Stars

Watchers

Forks

Packages

No packages published

Languages

  • Shell 66.9%
  • Makefile 14.6%
  • Smarty 13.2%
  • Ruby 5.3%