Skip to content

Instantly share code, notes, and snippets.

@yumitsu
Last active August 29, 2015 14:19
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 yumitsu/e0f951a03b1910279f8b to your computer and use it in GitHub Desktop.
Save yumitsu/e0f951a03b1910279f8b to your computer and use it in GitHub Desktop.
Vagrant.configure(2) do |config|
config.vm.define "boot2docker"
config.vm.box = "parallels/boot2docker"
config.vm.box_check_update = false
config.ssh.private_key_path = [
'~/.vagrant.d/insecure_private_key',
'~/.ssh/id_rsa'
]
config.ssh.forward_agent = true
config.vm.network "private_network", ip: "192.168.33.10"
config.vm.synced_folder ".", "/vagrant", type: "nfs"
# Fix busybox/udhcpc issue
config.vm.provision :shell do |s|
s.inline = <<-EOT
if ! grep -qs ^nameserver /etc/resolv.conf; then
sudo /sbin/udhcpc
fi
cat /etc/resolv.conf
EOT
end
# Adjust datetime after suspend and resume
config.vm.provision :shell do |s|
s.inline = <<-EOT
sudo /usr/local/bin/ntpclient -s -h pool.ntp.org
date
EOT
end
# Fix sshd_config to not ask for passwords with pubkey authentication
config.vm.provision :shell do |s|
s.inline = <<-EOT
sudo sed -i "s/#RSAAuthentication yes/RSAAuthentication yes/g" /var/lib/boot2docker/ssh/sshd_config
sudo sed -i "s/#PubkeyAuthentication yes/PubkeyAuthentication yes/g" /var/lib/boot2docker/ssh/sshd_config
sudo sed -i "s/#PasswordAuthentication yes/PasswordAuthentication no/g" /var/lib/boot2docker/ssh/sshd_config
sudo sed -i "s/#ChallengeResponseAuthentication yes/ChallengeResponseAuthentication no/g" /var/lib/boot2docker/ssh/sshd_config
sudo kill -HUP `echo $(ps ax | grep sbin/sshd -m 1) | cut -d " " -f 1`
EOT
end
config.vm.provider "parallels" do |v|
v.name = "boot2docker"
v.update_guest_tools = true
v.optimize_power_consumption = false
v.memory = 2048
v.cpus = 2
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment