Create Boot2Docker VirtualBox VM

Boot2Docker is perfect to test Docker Images/Container. This guide shows the fastest and easiest way to create a Boot2Docker VirtualBox VM.

Preconditions

Download Boot2Docker ISO

Download the necessary ISO Version from GitHub. In this tutorial I use theĀ “Default Machine Folder”.

Boot2Docker Release

Prepare and start VM

# create new VirtualBox VM
$ VBoxManage createvm --name "Boot2DockerVM" --ostype Linux_64 --register
 
# configure system settings of VM
$ VBoxManage modifyvm "Boot2DockerVM" --memory 2048 --cpus 2 --acpi on --pae on --hwvirtex on --nestedpaging on
 
# configure boot settings of VM
$ VBoxManage modifyvm "Boot2DockerVM" --boot1 dvd --boot2 none --boot3 none --boot4 none 

# configure basic settings
$ VBoxManage modifyvm "Boot2DockerVM" --vram 8 --audio none --accelerate3d off --accelerate2dvideo off --usb off

# configure network settings
$ VBoxManage modifyvm "Boot2DockerVM" --nic1 nat --nic2 bridged --bridgeadapter2 <devicename>

# Example MacBook Pro
$ VBoxManage modifyvm "Boot2DockerVM" --nic1 nat --nic2 bridged --bridgeadapter2 'en0: WLAN (AirPort)'

# modify a storage controller
$ VBoxManage storagectl "Boot2DockerVM" --name "IDE" --add ide
 
# add boot2docker iso
$ VBoxManage storageattach "Boot2DockerVM" --storagectl "IDE" --port 0 --device 0 --type dvddrive --medium boot2docker.iso

# start VM
$ VBoxManage startvm Boot2DockerVM

SSH into running VM

# ssh into VM (Password: tcuser)
$ ssh docker@<ip>

If all goes well …

                        ##         .
                  ## ## ##        ==
               ## ## ## ## ##    ===
           /"""""""""""""""""\___/ ===
      ~~~ {~~ ~~~~ ~~~ ~~~~ ~~~ ~ /  ===- ~~~
           \______ o           __/
             \    \         __/
              \____\_______/
 _                 _   ____     _            _
| |__   ___   ___ | |_|___ \ __| | ___   ___| | _____ _ __
| '_ \ / _ \ / _ \| __| __) / _` |/ _ \ / __| |/ / _ \ '__|
| |_) | (_) | (_) | |_ / __/ (_| | (_) | (__|   <  __/ |
|_.__/ \___/ \___/ \__|_____\__,_|\___/ \___|_|\_\___|_|
Boot2Docker version 1.10.3, build master : 625117e - Thu Mar 10 22:09:02 UTC 2016
Docker version 1.10.3, build 20f81dd