Install Docker.io on a VPS under XEN

Docker.io is really hyped nowadays, and there’s a good reason for that.
I’m not going to go in och any details of what Docker is here, this will be an installation guide for me to remember.

I’ll assume a VPS running Ubuntu Precise 12.04 (LTS) (64-bit) under XEN.

Step 1

Get a new Ubuntu VPS under XEN, create a user, remove root-login via SSH and update it.

adduser container
#Set a good password for now. Make sure you can login with the new user before continuing

#Upgrade and install some stuff you need.
apt-get update && apt-get upgrade
apt-get install nano curl git apt-transport-https

#set PermitRootLogin no
nano /etc/ssh/sshd_config

#Restart ssh
/etc/init.d/ssh restart

Step 2

Time to install Docker!

#We need a backported kernel since there's a bug in LXC
apt-get install linux-image-generic-lts-raring linux-headers-generic-lts-raring

#Update grub and reboot
update-grub
reboot

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

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

#Update lists
apt-get update

#Install docker
apt-get install lxc-docker

#Test it. This downloads and runs a base image of ubuntu and sends you inside it.
docker run -i -t base /bin/bash

#type exit to get out of the shell inside the container you just created

Posts on what to do with it will follow in the coming weeks.