Skip to content

VBox docker libcontainer setup

Glyn Normington edited this page Jun 20, 2014 · 2 revisions

Creating the Virtual Box environment for libcontainer testing

  • Get Virtual Box 4.3.12 from Oracle

  • Install and open vBox manager

  • Create a vm (named libcontainer Dev Test)

    • 2Gb RAM
    • 32Gb HDD
    • 4 processors (on separate menu)
    • username (spowell) (when installing op sys)
    • o/w defaults (ensure network connection -- NAT default)
  • Get Ubuntu (or other distro)

    • ubuntu-14.04-desktop-amd64.iso (got from Glyn)
  • Start vm and install from DVD

    • accept updates during boot/install
    • reboot (no need to remove DVD)
  • Install VBox Guest Additions

    • Devices menu in VBox (after booting VM) attaches image
    • Accept in dialog
    • Reboot (and get largest resolution for display -- can maximise afterwards, so don't worry)
  • Get git and mercurial (needed by go get)

    • sudo apt-get install git mercurial
  • Get go

    • (Firefox download from golang -- Linux AMD 64bit version -- we are currently on version 1.2.2)

    • After installation rename to ~/golang

    • Edit .profile to include:

        export GOROOT=$HOME/golang
        export GOPATH=$HOME/go
        export PATH=$GOPATH/bin:$PATH:$GOROOT/bin
      
    • Check we have the right version:

      • Reboot (.profile not rexecuted on restart Terminal? Then modify run terminal as login shell in Terminal preferences.)
      • go version in Terminal/Shell to check
      • env|grep GO to check setup
  • Now get the libcontainer code

      go get github.com/docker/libcontainer
    
  • Now build/test something

      cd ~/go/src/github.com/docker/libcontainer/nsinit
      go get -t ./...
      go install
      nsinit
    

    This outpouts help for nsinit (currently). We should get docker as a byproduct of the get.

Alternative to getting the libcontainer code

Share a folder with the host copy of the Guardian code.

  • Create shared folder on vbox

    • point to go project source root (GOPATH) on host
    • choose name for it (e.g. gomac)
    • is mounted in /media/sf-gomac
    • put local user in vboxsf group or else the folder cannot be accessed (!) sudo adduser spowell vboxsf
  • The go compiler needs to be installed on the vbox, still, and then updates to the code on the host are immediately visible to the vbox machine.

  • add a symboic link to the shared drive go folder ln -s /media/sf-gomac go

  • now try go install in the nsinit folder as above.

Note about permissions in git repositories

Sharing the git repository with the mac host is slightly dangerous, since the mount (type vboxsf) in Ubuntu seems to have the permissions look different in the VM. This is probably caused by mounting it with root user. To change this, execute the following commands in the VM:

sudo umount gomac
sudo mount -t vboxsf -o uid=1000,gid=1000 gomac /media/sf_gomac

Here 1000 is the id for the default user (spowell for me) and their group, gomac is the shared name I chose when defining the shared folder, and /media/sf_gomac is the name of the mount point (generated by VirtualBox in the obvious way).