Skip to content

Instantly share code, notes, and snippets.

@justincaldwell
Last active August 29, 2015 14:06
Show Gist options
  • Save justincaldwell/fdd81dc0fc764e094526 to your computer and use it in GitHub Desktop.
Save justincaldwell/fdd81dc0fc764e094526 to your computer and use it in GitHub Desktop.
# -*- mode: ruby -*-
# vi: set ft=ruby :
# Vagrantfile API/syntax version. Don't touch unless you know what you're doing!
VAGRANTFILE_API_VERSION = "2"
$script = <<SCRIPT
curl -sSL https://get.docker.io/ubuntu/ | sudo sh
usermod -a -G docker vagrant
echo "DOCKER_OPTS='-H unix:///var/run/docker.sock -H tcp://0.0.0.0:5555 --dns 172.17.42.1 --dns 8.8.8.8 --dns-search service.consul'" | sudo tee -a /etc/default/docker
curl -L -s https://github.com/docker/fig/releases/download/0.5.2/linux > /usr/local/bin/fig
chmod +x /usr/local/bin/fig
service docker restart
apt-get install -y -q vim-nox
update-alternatives --set editor /usr/bin/vim.nox
SCRIPT
Vagrant.configure(VAGRANTFILE_API_VERSION) do |config|
config.vm.box = "phusion-open-ubuntu-14.04-amd64"
config.vm.box_url = "https://oss-binaries.phusionpassenger.com/vagrant/boxes/latest/ubuntu-14.04-amd64-vbox.box"
config.vm.network "private_network", ip: "55.55.55.55"
config.ssh.forward_agent = true
config.vm.provision "shell", inline: $script
config.vm.synced_folder "data", "/data"
#config.vm.network "forwarded_port", guest: 3030, host: 3333
end
@justincaldwell
Copy link
Author

Installation

  1. Install vagrant + virtualbox or vmware

  2. Copy gist to Vagrantfile

  3. Install docker on mac (brew install docker but you can also download from docker's website)

  4. Make a data dir for volumes

    mkdir data data/log data/data
    
  5. Run the Vagrantfile

    vagrant up
    
  6. Set the DOCKER_HOST env var with export DOCKER_HOST='tcp://55.55.55.55:5555' or make it more permanent with

    echo "\nexport DOCKER_HOST='tcp://55.55.55.55:5555'" >> ~/.bashrc && source ~/.bashrc
    
  7. Test it out

    docker run -it --rm ubuntu /bin/bash
    

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment