How to use this box with Vagrant:

Vagrant.configure("2") do |config|
  config.vm.box = "yungsang/boot2docker"
end
vagrant init yungsang/boot2docker
vagrant up

This version was created over 9 years ago.

boot2docker with Docker v1.4.1

  • Based on boot2docker with Docker v1.4.1
  • Support NFS synced folder
  • Support Docker provisioner
  • Expose and forward the official IANA registered Docker port 2375
  • Add nsenter and docker-enter (docker-attach)
  • Remove TLS support from the original boot2docker
  • Add e2fsprogs for resize2fs

Cf.) https://github.com/YungSang/boot2docker-vagrant-box
Cf.) https://github.com/YungSang/boot2docker

FAQ

Sample Vagrantfile

VAGRANTFILE_API_VERSION = "2"

Vagrant.require_version ">= 1.6.3"

Vagrant.configure(VAGRANTFILE_API_VERSION) do |config|
  config.vm.define "boot2docker"

  config.vm.box = "yungsang/boot2docker"

  config.vm.synced_folder ".", "/vagrant"
  # Or you can use NFS as before
  # config.vm.network "private_network", ip: "192.168.33.10"
  # config.vm.synced_folder ".", "/vagrant", type: "nfs"

  # Uncomment below to use more than one instance at once
  # config.vm.network :forwarded_port, guest: 2375, host: 2375, auto_correct: true

  # 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

  config.vm.provision :docker do |d|
    d.pull_images "yungsang/busybox"
    d.run "simple-echo",
      image: "yungsang/busybox",
      args: "-p 8080:8080",
      cmd: "nc -p 8080 -l -l -e echo hello world!"
  end

  config.vm.network :forwarded_port, guest: 8080, host: 8080
end

For VirtualBox

$ vagrant init yungsang/boot2docker
$ vagrant up
$ docker version
$ docker images
$ docker ps
$ nc localhost 8080
hello world!
$ docker ps -l
CONTAINER ID        IMAGE                     COMMAND                CREATED             STATUS              PORTS                    NAMES
f3f38ced897a        yungsang/busybox:latest   nc -p 8080 -l -l -e    27 minutes ago      Up 9 minutes        0.0.0.0:8080->8080/tcp   simple-echo
$ docker exec $(docker ps -l -q) ps
PID   USER     COMMAND
    1 root     nc -p 8080 -l -l -e echo hello world!
   21 root     ps
$ docker exec -it $(docker ps -l -q) sh
/ # ps
PID   USER     COMMAND
    1 root     nc -p 8080 -l -l -e echo hello world!
   46 root     sh
   55 root     ps
/ # exit
$ 

For Parallels

I've dropped a box for Parallels from here. Instead, you can use parallels/boot2docker here.

1 provider for this version.
  • virtualbox
    unknown Externally hosted (github.com)

This version was created over 9 years ago.

boot2docker with Docker v1.3.3

  • Based on boot2docker with Docker v1.3.3
  • Support NFS synced folder
  • Support Docker provisioner
  • Expose and forward the official IANA registered Docker port 2375
  • Add nsenter and docker-enter (docker-attach)
  • Remove TLS support from the original boot2docker
  • Add e2fsprogs for resize2fs

Cf.) https://github.com/YungSang/boot2docker-vagrant-box
Cf.) https://github.com/YungSang/boot2docker

FAQ

Sample Vagrantfile

VAGRANTFILE_API_VERSION = "2"

Vagrant.require_version ">= 1.6.3"

Vagrant.configure(VAGRANTFILE_API_VERSION) do |config|
  config.vm.define "boot2docker"

  config.vm.box = "yungsang/boot2docker"

  config.vm.synced_folder ".", "/vagrant"
  # Or you can use NFS as before
  # config.vm.network "private_network", ip: "192.168.33.10"
  # config.vm.synced_folder ".", "/vagrant", type: "nfs"

  # Uncomment below to use more than one instance at once
  # config.vm.network :forwarded_port, guest: 2375, host: 2375, auto_correct: true

  # 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

  config.vm.provision :docker do |d|
    d.pull_images "yungsang/busybox"
    d.run "simple-echo",
      image: "yungsang/busybox",
      args: "-p 8080:8080",
      cmd: "nc -p 8080 -l -l -e echo hello world!"
  end

  config.vm.network :forwarded_port, guest: 8080, host: 8080
end

For VirtualBox

$ vagrant init yungsang/boot2docker
$ vagrant up
$ docker version
$ docker images
$ docker ps
$ nc localhost 8080
hello world!
$ docker ps -l
CONTAINER ID        IMAGE                     COMMAND                CREATED             STATUS              PORTS                    NAMES
f3f38ced897a        yungsang/busybox:latest   nc -p 8080 -l -l -e    27 minutes ago      Up 9 minutes        0.0.0.0:8080->8080/tcp   simple-echo
$ docker exec $(docker ps -l -q) ps
PID   USER     COMMAND
    1 root     nc -p 8080 -l -l -e echo hello world!
   21 root     ps
$ docker exec -it $(docker ps -l -q) sh
/ # ps
PID   USER     COMMAND
    1 root     nc -p 8080 -l -l -e echo hello world!
   46 root     sh
   55 root     ps
/ # exit
$ 

For Parallels

I've dropped a box for Parallels from here. Instead, you can use parallels/boot2docker here.

1 provider for this version.
  • virtualbox
    unknown Externally hosted (github.com)

This version was created over 9 years ago.

boot2docker with Docker v1.3.3

  • Based on boot2docker with Docker v1.3.3
  • Support NFS synced folder
  • Support Docker provisioner
  • Expose and forward the official IANA registered Docker port 2375
  • Add nsenter and docker-enter (docker-attach)
  • Remove TLS support from the original boot2docker
  • Add e2fsprogs for resize2fs

Cf.) https://github.com/YungSang/boot2docker-vagrant-box
Cf.) https://github.com/YungSang/boot2docker

FAQ

Sample Vagrantfile

VAGRANTFILE_API_VERSION = "2"

Vagrant.require_version ">= 1.6.3"

Vagrant.configure(VAGRANTFILE_API_VERSION) do |config|
  config.vm.define "boot2docker"

  config.vm.box = "yungsang/boot2docker"

  config.vm.synced_folder ".", "/vagrant"
  # Or you can use NFS as before
  # config.vm.network "private_network", ip: "192.168.33.10"
  # config.vm.synced_folder ".", "/vagrant", type: "nfs"

  # Uncomment below to use more than one instance at once
  # config.vm.network :forwarded_port, guest: 2375, host: 2375, auto_correct: true

  # 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

  config.vm.provision :docker do |d|
    d.pull_images "yungsang/busybox"
    d.run "simple-echo",
      image: "yungsang/busybox",
      args: "-p 8080:8080",
      cmd: "nc -p 8080 -l -l -e echo hello world!"
  end

  config.vm.network :forwarded_port, guest: 8080, host: 8080
end

For VirtualBox

$ vagrant init yungsang/boot2docker
$ vagrant up
$ docker version
$ docker images
$ docker ps
$ nc localhost 8080
hello world!
$ docker ps -l
CONTAINER ID        IMAGE                     COMMAND                CREATED             STATUS              PORTS                    NAMES
f3f38ced897a        yungsang/busybox:latest   nc -p 8080 -l -l -e    27 minutes ago      Up 9 minutes        0.0.0.0:8080->8080/tcp   simple-echo
$ docker exec $(docker ps -l -q) ps
PID   USER     COMMAND
    1 root     nc -p 8080 -l -l -e echo hello world!
   21 root     ps
$ docker exec -it $(docker ps -l -q) sh
/ # ps
PID   USER     COMMAND
    1 root     nc -p 8080 -l -l -e echo hello world!
   46 root     sh
   55 root     ps
/ # exit
$ 

For Parallels

I've dropped a box for Parallels from here. Instead, you can use parallels/boot2docker here.

1 provider for this version.
  • virtualbox
    unknown Externally hosted (github.com)

This version was created over 9 years ago.

boot2docker with Docker v1.3.2

  • Based on boot2docker with Docker v1.3.2
  • Support NFS synced folder
  • Support Docker provisioner
  • Expose and forward the official IANA registered Docker port 2375
  • Add nsenter and docker-enter (docker-attach)
  • Remove TLS support from the original boot2docker

Cf.) https://github.com/YungSang/boot2docker-vagrant-box
Cf.) https://github.com/YungSang/boot2docker

FAQ

Sample Vagrantfile

VAGRANTFILE_API_VERSION = "2"

Vagrant.require_version ">= 1.6.3"

Vagrant.configure(VAGRANTFILE_API_VERSION) do |config|
  config.vm.define "boot2docker"

  config.vm.box = "yungsang/boot2docker"

  config.vm.synced_folder ".", "/vagrant"
  # Or you can use NFS as before
  # config.vm.network "private_network", ip: "192.168.33.10"
  # config.vm.synced_folder ".", "/vagrant", type: "nfs"

  # Uncomment below to use more than one instance at once
  # config.vm.network :forwarded_port, guest: 2375, host: 2375, auto_correct: true

  # 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

  config.vm.provision :docker do |d|
    d.pull_images "yungsang/busybox"
    d.run "simple-echo",
      image: "yungsang/busybox",
      args: "-p 8080:8080",
      cmd: "nc -p 8080 -l -l -e echo hello world!"
  end

  config.vm.network :forwarded_port, guest: 8080, host: 8080
end

For VirtualBox

$ vagrant init yungsang/boot2docker
$ vagrant up
$ docker version
$ docker images
$ docker ps
$ nc localhost 8080
hello world!
$ docker ps -l
CONTAINER ID        IMAGE                     COMMAND                CREATED             STATUS              PORTS                    NAMES
f3f38ced897a        yungsang/busybox:latest   nc -p 8080 -l -l -e    27 minutes ago      Up 9 minutes        0.0.0.0:8080->8080/tcp   simple-echo
$ docker exec $(docker ps -l -q) ps
PID   USER     COMMAND
    1 root     nc -p 8080 -l -l -e echo hello world!
   21 root     ps
$ docker exec -it $(docker ps -l -q) sh
/ # ps
PID   USER     COMMAND
    1 root     nc -p 8080 -l -l -e echo hello world!
   46 root     sh
   55 root     ps
/ # exit
$ 

For Parallels

I've dropped a box for Parallels from here. Instead, you can use parallels/boot2docker here.

1 provider for this version.
  • virtualbox
    unknown Externally hosted (github.com)

This version was created over 9 years ago.

boot2docker with Docker v1.3.1

  • Based on boot2docker with Docker v1.3.1
  • Support NFS synced folder
  • Support Docker provisioner
  • Expose and forward the official IANA registered Docker port 2375
  • Add nsenter and docker-enter (docker-attach)
  • Remove TLS support from the original boot2docker

Cf.) https://github.com/YungSang/boot2docker-vagrant-box
Cf.) https://github.com/YungSang/boot2docker/tree/yungsang/boot2docker

FAQ

Sample Vagrantfile

VAGRANTFILE_API_VERSION = "2"

Vagrant.require_version ">= 1.6.3"

Vagrant.configure(VAGRANTFILE_API_VERSION) do |config|
  config.vm.define "boot2docker"

  config.vm.box = "yungsang/boot2docker"

  config.vm.network "private_network", ip: "192.168.33.10"

  config.vm.synced_folder ".", "/vagrant"
  # Or you can use NFS as before
  # config.vm.synced_folder ".", "/vagrant", type: "nfs"

  # Uncomment below to use more than one instance at once
  # config.vm.network :forwarded_port, guest: 2375, host: 2375, auto_correct: true

  # 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

  config.vm.provision :docker do |d|
    d.pull_images "yungsang/busybox"
    d.run "simple-echo",
      image: "yungsang/busybox",
      args: "-p 8080:8080",
      cmd: "nc -p 8080 -l -l -e echo hello world!"
  end

  config.vm.network :forwarded_port, guest: 8080, host: 8080
end

For VirtualBox

$ vagrant init yungsang/boot2docker
$ vagrant up
$ docker version
$ docker images
$ docker ps
$ nc localhost 8080
hello world!
$ docker ps -l
CONTAINER ID        IMAGE                     COMMAND                CREATED             STATUS              PORTS                    NAMES
f3f38ced897a        yungsang/busybox:latest   nc -p 8080 -l -l -e    27 minutes ago      Up 9 minutes        0.0.0.0:8080->8080/tcp   simple-echo
$ docker exec $(docker ps -l -q) ps
PID   USER     COMMAND
    1 root     nc -p 8080 -l -l -e echo hello world!
   21 root     ps
$ docker exec -it $(docker ps -l -q) sh
/ # ps
PID   USER     COMMAND
    1 root     nc -p 8080 -l -l -e echo hello world!
   46 root     sh
   55 root     ps
/ # exit
$ 

For Parallels

I've dropped a box for Parallels from here. Instead, you can use parallels/boot2docker here.

1 provider for this version.
  • virtualbox
    unknown Externally hosted (github.com)

This version was created over 9 years ago.

boot2docker with Docker v1.3.1

  • Based on boot2docker with Docker v1.3.1
  • Support NFS synced folder
  • Support Docker provisioner
  • Expose and forward the official IANA registered Docker port 2375
  • Add nsenter and docker-enter (docker-attach)
  • Remove TLS support from the original boot2docker

Cf.) https://github.com/YungSang/boot2docker-vagrant-box
Cf.) https://github.com/YungSang/boot2docker/tree/yungsang/boot2docker

FAQ

Sample Vagrantfile

VAGRANTFILE_API_VERSION = "2"

Vagrant.require_version ">= 1.6.3"

Vagrant.configure(VAGRANTFILE_API_VERSION) do |config|
  config.vm.define "boot2docker"

  config.vm.box = "yungsang/boot2docker"

  config.vm.network "private_network", ip: "192.168.33.10"

  config.vm.synced_folder ".", "/vagrant"
  # Or you can use NFS as before
  # config.vm.synced_folder ".", "/vagrant", type: "nfs"

  # Uncomment below to use more than one instance at once
  # config.vm.network :forwarded_port, guest: 2375, host: 2375, auto_correct: true

  # 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

  config.vm.provision :docker do |d|
    d.pull_images "yungsang/busybox"
    d.run "simple-echo",
      image: "yungsang/busybox",
      args: "-p 8080:8080",
      cmd: "nc -p 8080 -l -l -e echo hello world!"
  end

  config.vm.network :forwarded_port, guest: 8080, host: 8080
end

For VirtualBox

$ vagrant init yungsang/boot2docker
$ vagrant up
$ docker version
$ docker images
$ docker ps
$ nc localhost 8080
hello world!
$ docker ps -l
CONTAINER ID        IMAGE                     COMMAND                CREATED             STATUS              PORTS                    NAMES
f3f38ced897a        yungsang/busybox:latest   nc -p 8080 -l -l -e    27 minutes ago      Up 9 minutes        0.0.0.0:8080->8080/tcp   simple-echo
$ docker exec $(docker ps -l -q) ps
PID   USER     COMMAND
    1 root     nc -p 8080 -l -l -e echo hello world!
   21 root     ps
$ docker exec -it $(docker ps -l -q) sh
/ # ps
PID   USER     COMMAND
    1 root     nc -p 8080 -l -l -e echo hello world!
   46 root     sh
   55 root     ps
/ # exit
$ 

For Parallels

I've dropped a box for Parallels from here. Instead, you can use parallels/boot2docker here.

1 provider for this version.
  • virtualbox
    unknown Externally hosted (github.com)

This version was created over 9 years ago.

boot2docker with Docker v1.3.1

  • Based on boot2docker with Docker v1.3.1
  • Support NFS synced folder
  • Support Docker provisioner
  • Expose and forward the official IANA registered Docker port 2375
  • Add nsenter and docker-enter (docker-attach)
  • Remove TLS support from the original boot2docker

Cf.) https://github.com/YungSang/boot2docker-vagrant-box
Cf.) https://github.com/YungSang/boot2docker/tree/yungsang/boot2docker

FAQ

Sample Vagrantfile

VAGRANTFILE_API_VERSION = "2"

Vagrant.require_version ">= 1.6.3"

Vagrant.configure(VAGRANTFILE_API_VERSION) do |config|
  config.vm.define "boot2docker"

  config.vm.box = "yungsang/boot2docker"

  config.vm.network "private_network", ip: "192.168.33.10"

  config.vm.synced_folder ".", "/vagrant"
  # Or you can use NFS as before
  # config.vm.synced_folder ".", "/vagrant", type: "nfs"

  # Uncomment below to use more than one instance at once
  # config.vm.network :forwarded_port, guest: 2375, host: 2375, auto_correct: true

  # 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

  config.vm.provision :docker do |d|
    d.pull_images "yungsang/busybox"
    d.run "simple-echo",
      image: "yungsang/busybox",
      args: "-p 8080:8080",
      cmd: "nc -p 8080 -l -l -e echo hello world!"
  end

  config.vm.network :forwarded_port, guest: 8080, host: 8080
end

For VirtualBox

$ vagrant init yungsang/boot2docker
$ vagrant up
$ docker version
$ docker images
$ docker ps
$ nc localhost 8080
hello world!
$ docker ps -l
CONTAINER ID        IMAGE                     COMMAND                CREATED             STATUS              PORTS                    NAMES
f3f38ced897a        yungsang/busybox:latest   nc -p 8080 -l -l -e    27 minutes ago      Up 9 minutes        0.0.0.0:8080->8080/tcp   simple-echo
$ docker exec $(docker ps -l -q) ps
PID   USER     COMMAND
    1 root     nc -p 8080 -l -l -e echo hello world!
   21 root     ps
$ docker exec -it $(docker ps -l -q) sh
/ # ps
PID   USER     COMMAND
    1 root     nc -p 8080 -l -l -e echo hello world!
   46 root     sh
   55 root     ps
/ # exit
$ 

For Parallels

I've dropped a box for Parallels from here. Instead, you can use parallels/boot2docker here.

1 provider for this version.
  • virtualbox
    unknown Externally hosted (github.com)

This version was created over 9 years ago.

boot2docker with Docker v1.3.1

  • Based on boot2docker with Docker v1.3.1
  • Support NFS synced folder
  • Support Docker provisioner
  • Expose and forward the official IANA registered Docker port 2375
  • Add nsenter and docker-enter (docker-attach)
  • Remove TLS support from the original boot2docker

Cf.) https://github.com/YungSang/boot2docker-vagrant-box
Cf.) https://github.com/YungSang/boot2docker/tree/yungsang/boot2docker

FAQ

Sample Vagrantfile

VAGRANTFILE_API_VERSION = "2"

Vagrant.require_version ">= 1.6.3"

Vagrant.configure(VAGRANTFILE_API_VERSION) do |config|
  config.vm.define "boot2docker"

  config.vm.box = "yungsang/boot2docker"

  config.vm.network "private_network", ip: "192.168.33.10"

  config.vm.synced_folder ".", "/vagrant"
  # Or you can use NFS as before
  # config.vm.synced_folder ".", "/vagrant", type: "nfs"

  # Uncomment below to use more than one instance at once
  # config.vm.network :forwarded_port, guest: 2375, host: 2375, auto_correct: true

  # 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

  config.vm.provision :docker do |d|
    d.pull_images "yungsang/busybox"
    d.run "simple-echo",
      image: "yungsang/busybox",
      args: "-p 8080:8080",
      cmd: "nc -p 8080 -l -l -e echo hello world!"
  end

  config.vm.network :forwarded_port, guest: 8080, host: 8080
end

For VirtualBox

$ vagrant init yungsang/boot2docker
$ vagrant up
$ docker version
$ docker images
$ docker ps
$ nc localhost 8080
hello world!
$ docker ps -l
CONTAINER ID        IMAGE                     COMMAND                CREATED             STATUS              PORTS                    NAMES
f3f38ced897a        yungsang/busybox:latest   nc -p 8080 -l -l -e    27 minutes ago      Up 9 minutes        0.0.0.0:8080->8080/tcp   simple-echo
$ docker exec $(docker ps -l -q) ps
PID   USER     COMMAND
    1 root     nc -p 8080 -l -l -e echo hello world!
   21 root     ps
$ docker exec -it $(docker ps -l -q) sh
/ # ps
PID   USER     COMMAND
    1 root     nc -p 8080 -l -l -e echo hello world!
   46 root     sh
   55 root     ps
/ # exit
$ 

For Parallels

I've dropped a box for Parallels from here. Instead, you can use parallels/boot2docker here.

1 provider for this version.
  • virtualbox
    unknown Externally hosted (github.com)

This version was created over 9 years ago.

boot2docker with Docker v1.3.0

  • Based on boot2docker with Docker v1.3.0
  • Support NFS synced folder
  • Support Docker provisioner
  • Expose and forward the official IANA registered Docker port 2375
  • Add nsenter and docker-enter (docker-attach)
  • Remove TLS support from the original boot2docker

Cf.) https://github.com/YungSang/boot2docker-vagrant-box
Cf.) https://github.com/YungSang/boot2docker/tree/nsenter+without-TLS
Cf.) https://github.com/YungSang/vagrant-docker-helper

FAQ

Sample Vagrantfile

VAGRANTFILE_API_VERSION = "2"

Vagrant.require_version ">= 1.6.3"

Vagrant.configure(VAGRANTFILE_API_VERSION) do |config|
  config.vm.define "boot2docker"

  config.vm.box = "yungsang/boot2docker"

  config.vm.network "private_network", ip: "192.168.33.10"

  config.vm.synced_folder ".", "/vagrant"
  # Or you can use NFS as before
  # config.vm.synced_folder ".", "/vagrant", type: "nfs"

  # Uncomment below to use more than one instance at once
  # config.vm.network :forwarded_port, guest: 2375, host: 2375, auto_correct: true

  # 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

  config.vm.provision :docker do |d|
    d.pull_images "yungsang/busybox"
    d.run "simple-echo",
      image: "yungsang/busybox",
      args: "-p 8080:8080",
      cmd: "nc -p 8080 -l -l -e echo hello world!"
  end

  config.vm.network :forwarded_port, guest: 8080, host: 8080
end

For VirtualBox

$ vagrant init yungsang/boot2docker
$ vagrant up
$ docker version
$ docker images
$ docker ps
$ nc localhost 8080
hello world!
$ docker ps -l
CONTAINER ID        IMAGE                     COMMAND                CREATED             STATUS              PORTS                    NAMES
f3f38ced897a        yungsang/busybox:latest   nc -p 8080 -l -l -e    27 minutes ago      Up 9 minutes        0.0.0.0:8080->8080/tcp   simple-echo
$ docker exec $(docker ps -l -q) ps
PID   USER     COMMAND
    1 root     nc -p 8080 -l -l -e echo hello world!
   21 root     ps
$ docker exec -it $(docker ps -l -q) sh
/ # ps
PID   USER     COMMAND
    1 root     nc -p 8080 -l -l -e echo hello world!
   46 root     sh
   55 root     ps
/ # exit
$ 

For Parallels

I've dropped a box for Parallels from here. Instead, you can use parallels/boot2docker here.

1 provider for this version.
  • virtualbox
    unknown Externally hosted (github.com)

This version was created almost 10 years ago.

boot2docker with Docker v1.2.0

  • Based on boot2docker with Docker v1.2.0
  • Support NFS synced folder
  • Support Docker provisioner
  • Expose and forward the official IANA registered Docker port 2375
  • Add nsenter and docker-enter (docker-attach)
  • Remove TLS support from the original boot2docker
  • Support vboxfs as well

Cf.) https://github.com/YungSang/boot2docker-vagrant-box
Cf.) https://github.com/YungSang/boot2docker/tree/nsenter+without-TLS
Cf.) https://github.com/YungSang/vagrant-docker-helper

FAQ

Sample Vagrantfile

VAGRANTFILE_API_VERSION = "2"

Vagrant.require_version ">= 1.6.3"

Vagrant.configure(VAGRANTFILE_API_VERSION) do |config|
  config.vm.define "boot2docker"

  config.vm.box = "yungsang/boot2docker"

  config.vm.network "private_network", ip: "192.168.33.10"

  config.vm.synced_folder ".", "/vagrant"
  # Or you can use NFS as before
  # config.vm.synced_folder ".", "/vagrant", type: "nfs"

  # Uncomment below to use more than one instance at once
  # config.vm.network :forwarded_port, guest: 2375, host: 2375, auto_correct: true

  # 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

  config.vm.provision :docker do |d|
    d.pull_images "yungsang/busybox"
    d.run "simple-echo",
      image: "yungsang/busybox",
      args: "-p 8080:8080",
      cmd: "nc -p 8080 -l -l -e echo hello world!"
  end

  config.vm.network :forwarded_port, guest: 8080, host: 8080
end

For VirtualBox

$ vagrant init yungsang/boot2docker
$ vagrant up
$ docker version
$ docker images
$ docker ps
$ nc localhost 8080
hello world!

nsenter and docker-enter (docker-attach)

I made docker-enter script for you to attach a container using nsenter easily.
Cf.) https://github.com/YungSang/docker-attach

$ docker ps -l
CONTAINER ID        IMAGE                     COMMAND                CREATED             STATUS              PORTS                    NAMES
f3f38ced897a        yungsang/busybox:latest   nc -p 8080 -l -l -e    27 minutes ago      Up 9 minutes        0.0.0.0:8080->8080/tcp   simple-echo
$ vagrant ssh -c 'docker-enter $(docker ps -l -q) ps'
nsenter --target 891 --mount --uts --ipc --net --pid ps
PID   USER     COMMAND
    1 root     nc -p 8080 -l -l -e echo hello world!
    9 root     ps
Connection to 127.0.0.1 closed.
$ vagrant ssh -c 'docker-enter $(docker ps -l -q) sh'
nsenter --target 891 --mount --uts --ipc --net --pid
/ # ps
PID   USER     COMMAND
    1 root     nc -p 8080 -l -l -e echo hello world!
   15 root     sh
   16 root     ps
/ # exit
Connection to 127.0.0.1 closed.
$ 

Cf.) If you run SSHD in your Docker containers, you're doing it wrong!

For Parallels

I've dropped a box for Parallels from here. Instead, you can use parallels/boot2docker here.

1 provider for this version.
  • virtualbox
    unknown Externally hosted (github.com)
Next