lost and found ( for me ? )

install docker on Ubuntu 14.04 running within virtualbox

Here are trial and error logs when installing docker on Ubuntu 14.04 which is running within virtualbox as a virtual machine.

I used vagrant to prepare VMs for docker testing environment.
I already downloaded some boxes in my machine and used trusty64(virtualbox).
$ vagrant box list
centos60      (virtualbox, 0)
coreos-alpha  (virtualbox, 752.1.0)
coreos-stable (virtualbox, 717.3.0)
trusty64      (libvirt, 0)
trusty64      (virtualbox, 0)

initialize a new vagrant environment for docker testing environment.
$ vagrant init trusty64

Here is a Vagrantfile.
I prepared two VMs for a clustering test( I will evaluate that later)  and each VM has three vNICs.
$ cat Vagrantfile
Vagrant.configure(2) do |config|
 config.vm.box = "trusty64"
 config.vm.provider "virtualbox" do |v|
   v.memory = 2048
   v.cpus = 1

 config.vm.define :ubuntu01 do |ubuntu01|
   ubuntu01.vm.hostname = "ubuntu01"
   ubuntu01.vm.network :private_network, ip: ""
   ubuntu01.vm.network :private_network, ip: ""
   ubuntu01.vm.network :private_network, ip: ""

 config.vm.define :ubuntu02 do |ubuntu02|
   ubuntu02.vm.hostname = "ubuntu02"
   ubuntu02.vm.network :private_network, ip: ""
   ubuntu02.vm.network :private_network, ip: ""
   ubuntu02.vm.network :private_network, ip: ""

start the VMs
$ vagrant up

$ vagrant status
Current machine states:

ubuntu01                  running (virtualbox)
ubuntu02                  running (virtualbox)

access to the “ubuntu01” VM
$ vagrant ssh ubuntu01

vagrant@ubuntu01:~$ ifconfig -a | grep 192
         inet addr:  Bcast:  Mask:
         inet addr:  Bcast:  Mask:
         inet addr:  Bcast:  Mask:

install docker within this virtual machine(ubuntu01).
vagrant@ubuntu01:~$ sudo apt-get update

vagrant@ubuntu01:~$ sudo apt-get install docker.io

vagrant@ubuntu01:~$ docker --version
Docker version 1.0.1, build 990021a

docker.io is a symbolic link file of docker.
Googling docker installation tutorials, it seems that we need to create a symbolic link manually, however, in my case, I do not need to do that.
The symbolic link was created automatically.
vagrant@ubuntu01:~$ ls -l /usr/bin/docker*
-rwxr-xr-x 1 root root 15240483 Aug 21  2014 /usr/bin/docker
lrwxrwxrwx 1 root root        6 Aug 21  2014 /usr/bin/docker.io -> docker

confirm docker is running as a background process.
vagrant@ubuntu01:~$ sudo service docker.io status
docker.io start/running, process 26735

start docker.io when a server boots up.
vagrant@ubuntu01:~$ sudo update-rc.d docker.io defaults

download a docker container
vagrant@ubuntu01:~$ sudo docker pull ubuntu

run a docker container.
vagrant@ubuntu01:~$ sudo docker run -i -t ubuntu /bin/bash

open another terminal
list containers running.
vagrant@ubuntu01:~$ sudo docker ps
CONTAINER ID        IMAGE               COMMAND             CREATED              STATUS              PORTS               NAMES
84bf7f3be749        ubuntu:14.04        /bin/bash           About a minute ago   Up About a minute                       furious_curie       

stop the container
vagrant@ubuntu01:~$ sudo docker stop 84bf7f3be749

vagrant@ubuntu01:~$ sudo docker ps
CONTAINER ID        IMAGE               COMMAND             CREATED             STATUS              PORTS               NAMES


No comments:

Post a Comment

Note: Only a member of this blog may post a comment.