Docker.io & Redis on DigitalOcean in 5mins

It all started when I casually spotted a sponsored tweet offering me $10 worth of virtual computing power from digital ocean. I had seen their ads on everything from Facebook to Gmail and thought I’d check out what the fuss was about.

I had been planning to try docker.io on something other than my macbook for a while and was tempted to run up another linode server. Instead I decided to see if I could get docker running on digitalocean.

Docker turned 0.6 over the weekend and is heading full speed towards a production grade container platform. If you are reading this post you probably already interested in docker but for the uninitiated docker allows you to ship applications as containers running in what appears to be self contained linux environments. Its is based upon linux container magic and runs within same operating system as its host.

So here is my guide to get docker 0.6.1 running on digital ocean vm (5 minutes starts now!)

First create a new droplet based upon the Ubuntu 13.04 x64 image

ImageCreate the droplet and within a minute or so you should be able to interact with your new machine. Your root password is emailed to the registered email address

Once it is created ssh directly on to the box as root, for me it was as simple as 

 ssh root@192.241.174.17

Now following docker’s install guide I ran

apt-get update
apt-get install linux-image-extra-`uname -r`

sh -c "curl http://get.docker.io/gpg | apt-key add -"

sh -c "echo deb https://get.docker.io/ubuntu docker main > /etc/apt/sources.list.d/docker.list"

apt-get update
apt-get install lxc-docker

Which allowed me to run docker for the first time 

root@blog:~# docker version
Client version: 0.6.1
Server version: 0.6.1
Git commit: 5105263
Go version: go1.1.2
Last stable version: 0.6.1

Now to run something exciting, lets run redis

docker run -d johncosta/redis 

Install redis-cli on the host machine

apt-get install redis-server

redis-cli -h 192.241.174.17 -p 6379

Or connect from your macbook

brew install redis

redis-cli -h 192.241.174.17 -p 6379

Now time to play with redis

redis localhost:6379> set docker magic
OK
redis localhost:6379> get docker
"magic" 

5 minutes must be up by now!

About these ads

One thought on “Docker.io & Redis on DigitalOcean in 5mins

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s