Skip to content

Instantly share code, notes, and snippets.

@michaloo
Created January 2, 2017 09: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 michaloo/5fa768e059b12ab2ca82265eb7eb6fec to your computer and use it in GitHub Desktop.
Save michaloo/5fa768e059b12ab2ca82265eb7eb6fec to your computer and use it in GitHub Desktop.
Docker Vagrantfile
VAGRANTFILE_API_VERSION = "2"
Vagrant.configure(VAGRANTFILE_API_VERSION) do |config|
config.vm.define "ubuntu" do |ubuntu|
ubuntu.vm.box = "ubuntu"
ubuntu.vm.box_url = "https://cloud-images.ubuntu.com/vagrant/trusty/current/trusty-server-cloudimg-amd64-vagrant-disk1.box"
ubuntu.vm.network "private_network", ip: "192.168.50.4"
ubuntu.vm.synced_folder(
".",
File.dirname(__FILE__),
:nfs => true,
#:mount_options => ['noatime,soft,nfsvers=3'],
:mount_options => ['nolock,vers=3,udp,noatime,actimeo=1'],
:export_options => ['async,insecure,no_subtree_check,no_acl,no_root_squash']
)
#:mount_options => ['nolock'] #,vers=3,udp']
ubuntu.vm.synced_folder '.', '/vagrant', disabled: true
ubuntu.vm.provider :virtualbox do |vb|
# Use VBoxManage to customize the VM. For example to change memory:
vb.customize ["modifyvm", :id, "--memory", "1024"]
vb.customize ["modifyvm", :id, "--natdnshostresolver1", "on"]
vb.customize ["modifyvm", :id, "--natdnsproxy1", "on"]
end
ubuntu.vm.provision "shell",
inline: "curl -sSL https://get.docker.io/ubuntu/ | sudo sh", privileged: false
ubuntu.vm.provision "shell",
inline: "sudo sed -i -e 's/DOCKER_OPTS=.*/DOCKER_OPTS=\"-H 0.0.0.0:2375\"/' /etc/init/docker.conf && sudo service docker restart",
privileged: false
ubuntu.vm.provision "shell",
inline: "echo 'export DOCKER_HOST=tcp://127.0.0.1:2375' >> ~/.bashrc && source ~/.bashrc", privileged: false
ubuntu.vm.provision "shell",
inline: "echo never | sudo tee /sys/kernel/mm/transparent_hugepage/enabled", privileged: false
ubuntu.vm.post_up_message = 'export DOCKER_HOST="tcp://192.168.50.4:2375"'
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment