0
votes

I have virtual box in my ubuntu 14.4 system and vagrant is installed in virtual box. But if i try to install docker into vagrant virtual machine and used below command in vagrant machine
'docker --version '

It shows docker version and options like -help -display - color

but when i try to run docker with below command 'sudo docker run -t -i ubuntu:12.04 /bin/bash'

It showing below error 'its not entering into bash mode of docker'

1
This post belongs on unix.stackexchange.com.Sildoreth
Highly recommend using docker machine for running Docker within a virtualbox VM.Mark O'Connor

1 Answers

2
votes

To clarify:

  • VirtualBox runs virtual machines (VMs)
  • Docker runs containers
  • Vagrant is a declarative interface for VirtualBox VMs (and other providers)

If you have installed vagrant inside a VirtualBox VM, you would also need to install VirtualBox into that VM to be able to use Vagrant with it. This is probably not what you want to do.

Docker should probably be installed and run from your Ubuntu host, as this will give you greater performance than host->VM->docker.

On Ubuntu 12:04 the kernel must be upgraded and docker installation is more difficult. The docker package shipped with 12:04 is not the docker you expect it to be if it outputs this:

root@29a3f3134898:/# docker --version
docker - version 1.4
Copyright 2003, Ben Jansens <[email protected]>

It would be easier to run a more recent Ubuntu version (where installation is as simple as sudo apt-get update && sudo apt-get install docker.io - source), but if you need 12:04 then these instructions are from here copied here for posterity:

# install the backported kernel
$ sudo apt-get update
$ sudo apt-get install linux-image-generic-lts-trusty linux-headers-generic-lts-trusty

# install the backported kernel and xorg if using Unity/Xorg
$ sudo apt-get install --install-recommends linux-generic-lts-trusty xserver-xorg-lts-trusty libgl1-mesa-glx-lts-trusty

# reboot
$ sudo reboot

...

[ -e /usr/lib/apt/methods/https ] || {
  apt-get update
  apt-get install apt-transport-https
}
$ sudo apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv-keys 36A1D7869245C8950F966E92D8576A8BA88D21E9
$ sudo sh -c "echo deb https://get.docker.com/ubuntu docker main\
> /etc/apt/sources.list.d/docker.list"
$ sudo apt-get update
$ sudo apt-get install lxc-docker