Skip to content

Instantly share code, notes, and snippets.

@cmoulliard
Last active August 29, 2015 14:15
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save cmoulliard/d9721a83dabf9c8fabd5 to your computer and use it in GitHub Desktop.
Save cmoulliard/d9721a83dabf9c8fabd5 to your computer and use it in GitHub Desktop.
# -*- mode: ruby -*-
# vi: set ft=ruby :
# Specify Vagrant version and Vagrant API version
Vagrant.require_version ">= 1.6.0"
VAGRANTFILE_API_VERSION = "2"
$provisionScript = <<SCRIPT
# add host
echo 172.28.128.4 vagrant-ubuntu-trusty-64 >> /etc/hosts
# update limits
echo >> /etc/security/limits.conf
echo * hard nproc 8192 >> /etc/security/limits.conf
echo * soft nproc 8192 >> /etc/security/limits.conf
echo * hard nofile 8192 >> /etc/security/limits.conf
echo * soft nofile 8192 >> /etc/security/limits.conf
# add dcoker_ip address
echo >> $HOME/.bashrc
echo export DOCKER_IP=172.28.128.4 >> ~/.bashrc
# add some user aliases
echo alias osc=\"docker run --rm -i --net=host openshift/origin osc\" >> $HOME/.bash_aliases
echo alias kube=\"docker run --rm -i --net=host openshift/origin kube\" >> $HOME/.bash_aliases
SCRIPT
# Create and configure the VM(s)
Vagrant.configure(VAGRANTFILE_API_VERSION) do |config|
#
# Assign a friendly name to this host VM
#
config.vm.hostname = "docker-host"
#
# Add a private network between Host & VM
#
config.vm.network "private_network", ip: "172.28.128.4"
config.vm.provider "virtualbox" do |v|
v.memory = 8192
v.cpus = 4
v.name = "ubuntu-docker-openshiftv3"
#
# Using the host's resolver as a DNS proxy in NAT mode
#
v.customize ["modifyvm", :id, "--natdnshostresolver1", "on"]
end
config.vm.provision "shell", privileged: false, inline: $provisionScript
#
# Skip checking for an updated Vagrant box
#
config.vm.box_check_update = false
#
# Always use Vagrant's default insecure key
#
# config.ssh.insert_key = false
#
# Spin up a "host box" for use with the Docker provider
# and then provision it with Docker
#
config.vm.box = "ubuntu/trusty64"
#
# Disable synced folders (prevents an NFS error on "vagrant up")
#
config.vm.synced_folder ".", "/vagrant", disabled: true
config.vm.provision "docker" do |d|
d.run "openshift",
image: "openshift/origin:latest",
cmd: "start",
args: "-v /var/run/docker.sock:/var/run/docker.sock --privileged --net=host --name openshift-origin"
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment