Technology

Docker

I'm finally jumping in on the Docker bandwagon and it is pretty exciting.  Here's how I did a quick trial of it to make it work.

Install OS

I could do this in my AWS account, or I can do it with my local private cloud.  So many options these days.  I installed the latest Ubuntu 14.04 Trusty server on my local cloud.  It probably would have been just as easy to spin it up on AWS. I had to get my proxy set up correctly before I could get out to the Internet.  This was done by editing /etc/apt/apt.conf.  I just added the one line:
Acquire::http::Proxy "http://myproxy.com:80";

Configure for Docker

I followed the docker documentation on this.  Everything was pretty flawless.  I ran:
sudo apt-get update 
sudo apt-get install docker.io
sudo ln -sf /usr/bin/docker.io /usr/local/bin/docker
sudo sed -i '$acomplete -F _docker docker' /etc/bash_completion.d/docker.io 
source /etc/bash_completion.d/docker.io
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

sudo docker run -i -t ubuntu /bin/bash 
That last command had problems. The error I got said:
2014/10/30 15:08:42 Get https://index.docker.io/v1/repositories/library/ubuntu/images: dial tcp 162.242.195.84:443: connection timed out
This is because I need to put a proxy on my docker configuration. A quick google, search lead me to do:
sudo vim /etc/default/docker
I added my proxy host
export http_proxy="http://myproxy.com:80"
Rerunning
sudo docker run -i -t ubuntu /bin/bash
And I see a ton of stuff get downloaded. Looks like it works! Now I have docker on my VM.  But what can we do with it?  Containers are used for applications. Creating a python application would probably be a good start. I searched around and found a good one on Digital Ocean's site.
sudo docker run -i -t -p 80:80 ubuntu /bin/bash
I like how it showed how to detach: CTRL-P and CTRL-Q. To reattach:
sudo docker ps
Get the image ID, then reattach
sudo docker attach
Docker is one of many interesting projects I've been looking at lately. For my own projects, I'll be using Docker more for easing deployment. If you saw from my article yesterday, I've been working on public clouds as well as internal clouds. Connecting those clouds together and letting applications migrate between them is where I'll be spending a few more hours on this week and next.