Getting Docker Installed on Ubuntu 12.04 LTS

A few days ago I posted the blog entry “Using SSH Locally to Work With Ubuntu VM + VMware Tools Installation via Shell“, it was related to getting a clean Ubuntu Server install running with VMware Tools and so that I could use it as a hosted instance. Simply put, being able to SSH into it just as I would a hosted AWS or Windows Azure Ubuntu Server image. Once I had the default virtual machine running 12.04 LTS I went about another installation that is needed to run Docker. Docker will have issues with anything pre-3.8 kernel. Running the command below will show that kernel 3.5 is the current kernel in 12.04 LTS.

apt-cache search linux-headers-$(uname -r)

To update to the 3.8 kernel I ran the following command and then rebooted.

sudo apt-get install linux-image-generic-lts-raring linux-headers-generic-lts-raring
sudo shutdown -r now

With the reboot complete, I checked the kernel version again and 3.8 was installed successfully.

@ubuntu:~$ apt-cache search linux-headers-$(uname -r)
linux-headers-3.8.0-33-generic - Linux kernel headers for version 3.8.0 on 64 bit x86 SMP

To get Docker installed (as of 0.6) run the following command.

sudo sh -c "wget -qO- https://get.docker.io/gpg | apt-key add -"
sudo sh -c "echo deb http://get.docker.io/ubuntu docker main\
> /etc/apt/sources.list.d/docker.list"

Next update the sources, then install lxc-docker.

sudo apt-get update
sudo apt-get install lxc-docker

To verify that docker is installed I executed the following command and…

sudo docker run -i -t ubuntu /bin/bash

…see similar results just after issuing the command.

Unable to find image 'ubuntu' (tag: latest) locally
Pulling repository ubuntu
8dbd9e392a96: Download complete
b750fe79269d: Download complete
27cf78414709: Download complete

After that displays then I typed exit to leave docker. I now have a running version of docker on the Ubuntu 12.04 LTS instance ready for testing and hacking with docker.

4 thoughts on “Getting Docker Installed on Ubuntu 12.04 LTS

  1. krishan says:

    I am geeting an error after sudo docker run -i -t ubuntu /bin/bash
    Error : no answer from server

    • It sounds like the server never started running. Did you get any other error messages when you ran “sudo apt-get install lxc-docker”? Also have you verified that you have the latest kernel? It needs to be at least 3.8 vs. the common 12.04 LTS version.

  2. krishan says:

    Sir, i am using Ubuntu:13.04 with kernel version 3.8.0-35-generic.
    I am not geeting any other error when i run “sudo apt-get install lxc-docker” but i am geting an error only after “sudo docker run -i -t ubuntu /bin/bash” Error: no answer from server. You told that this error belong to “server never started yet in running state”.So i try from “Using SSH Locally to Work With Ubuntu VM + VMware Tools Installation via Shell” first then come back.
    if you have any suggestion.Please, leave.
    Thanks…

Comments are closed.