Skip to content

Instantly share code, notes, and snippets.

What would you like to do?

Docker Mac binary:

curl -L -o docker
chmod +x docker
sudo mv docker /usr/local/bin/docker

Install nsenter in the box:

docker run --rm -v /var/lib/boot2docker/:/target jpetazzo/nsenter

Put this next to your Vagrantfile:


vagrant ssh -c "sudo /var/lib/boot2docker/docker-enter $1"

Use it: ./docker-enter container_name

Vagrant.require_version ">= 1.6.3"
Vagrant.configure(VAGRANTFILE_API_VERSION) do |config|
config.vm.define "boot2docker" = "yungsang/boot2docker"
config.vm.box_check_update = false "private_network", ip: ""
# Mount current dir under same path in VM
config.vm.synced_folder ".", Dir.pwd, type: "nfs", mount_options: ["nolock", "vers=3", "udp"]
config.vm.provider :virtualbox do |vb, override|
vb.customize ["modifyvm", :id, "--memory", "2048"]
# Fix busybox/udhcpc issue
config.vm.provision :shell do |s|
s.inline = <<-EOT
if ! grep -qs ^nameserver /etc/resolv.conf; then
sudo /sbin/udhcpc
cat /etc/resolv.conf
# Adjust datetime after suspend and resume
config.vm.provision :shell do |s|
s.inline = <<-EOT
sudo /usr/local/bin/ntpclient -s -h

This comment has been minimized.

Copy link

tonivdv commented Feb 13, 2015

Hey @michaelsauter,

Thanks for sharing this gist. However I have a question. Am I mistaken if I say that this setup should work seamlessly as if I would use boot2docker directly ?

Because currently when I run a container from my osx terminal with -v from:to it doesn't share the files to my vagrant box ...

Thanks in advance for your time.


This comment has been minimized.

Copy link

tonivdv commented Feb 16, 2015

I figured it out. Boot2docker by default shares /Users on mac, thus you're able to use the absolute path ... however when using vagrant it all depends on how you share initially ... Following post helped me understanding this

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.