Created
February 28, 2015 01:08
-
-
Save schmunk42/f9f4f89550beeb28d166 to your computer and use it in GitHub Desktop.
Vagrantfile for a dockerhost
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Vagrantfile API/syntax version. Don't touch unless you know what you're doing! | |
VAGRANTFILE_API_VERSION = "2" | |
Vagrant.configure(VAGRANTFILE_API_VERSION) do |config| | |
config.vm.box = "hashicorp/precise64" | |
config.vm.synced_folder "./", "/vagrant", type: "rsync" | |
# Access docker container via private_network interface | |
# Port mapping to this IP can be defined in the Vagrantfile of the container | |
config.vm.network "private_network", ip: "192.168.3.3", netmask: "255.255.255.0" | |
config.vm.provider :virtualbox do |vb| | |
vb.customize ["modifyvm", :id, "--nicpromisc2", "allow-all"] | |
end | |
if Dir.glob("#{File.dirname(__FILE__)}/.vagrant/machines/default/*/id").empty? | |
# Install Docker | |
pkg_cmd = "wget -q -O - https://get.docker.io/gpg | apt-key add -;" \ | |
"echo deb http://get.docker.io/ubuntu docker main > /etc/apt/sources.list.d/docker.list;" \ | |
"apt-get update -qq; apt-get install -q -y --force-yes lxc-docker; " | |
# Add vagrant user to the docker group | |
pkg_cmd << "usermod -a -G docker vagrant; " | |
config.vm.provision :shell, :inline => pkg_cmd | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment