Reproducible science with Docker and VirtualBox

How to use Docker and VirtualBox
Club Bioinfo
Author

Laurent Modolo

Published

July 14, 2018

Oracle VM VirtualBox (VirtualBox)

Install

On Ubuntu:

sudo apt-get update
sudo apt-get install -y virtualbox virtualbox-qt virtualbox-dkms
sudo usermod -G vboxusers -a $USER

On MacOS:

brew install Caskroom/cask/virtualbox
brew install Caskroom/cask/virtualbox-extension-pack

Create virtual machine (VM)

  • Launch VirtualBox
  • Click on New
  • Set name to ubuntu-16, set type to Linux and version to Ubuntu (64-bit)
  • Click on Next
  • Set to 4000 Mio or more
  • Click on Next
  • Check create virtual disc now
  • Check VDI
  • Click on Next
  • Check Dynamically allocated
  • Click on Next
  • Set maximum value
  • Click on Create

 

Install VM

Download ubuntu 16.04:

wget http://releases.ubuntu.com/16.04.3/ubuntu-16.04.3-desktop-amd64.iso
  • Select ubuntu-16 in the list of VM
  • Click on settings
  • Click on display
  • Set Video memory to 128Mo
  • Check the two Acceleration boxes
  • Click on storage
  • Click on Empty in the Controller: IDE section
  • Click on the small disk icon and on Choose virtual disc file
  • Select your file ubuntu-16.04.3-desktop-amd64.iso and click on Open
  • Click on OK
  • Click on Start

You can now install Ubuntu 16.04 on your VM

  • Click on install ubuntu
  • Check Download updates while installing ubuntu
  • Check erase disks and install ubuntu
  • Click on install now and Continue on the popup window
  • Click on continue
  • Select your Keyboard and click on continue
  • Create your account and click on continue

Ubuntu is installing

  • Click on restart now
  • Press enter

 

Vagrant

Install

On Ubuntu:

wget https://releases.hashicorp.com/vagrant/2.0.1/vagrant_2.0.1_x86_64.deb
sudo dpkg -i vagrant_2.0.1_x86_64.deb

On MacOS:

brew install Caskroom/cask/vagrant
brew install Caskroom/cask/vagrant-manager

Create VM and install Ubuntu on it

Download Ubuntu 12.04 and start the VM

mkdir sandbox
cd sandbox
vagrant init hashicorp/precise64
vagrant up

You can find more box from the HashiCorp's Vagrant Cloud box catalog

vagrant ssh

 

Docker

Install

On Ubuntu:

sudo apt-get update
sudo apt-get install -y docker.io
sudo usermod -aG docker $USER
sudo service docker start

On MacOS:

brew cask install virtualbox
brew install docker
brew install boot2docker
boot2docker init
boot2docker up

Or download it here

Launch containers

Test docker:

docker run hello-world
docker run -i -t ubuntu /bin/bash