GoDaddy left at the Docker

I’m in the process of checking out the advantages and disadvantages of GoDaddy’s new Cloud Server product, which has just been announced as generally available. It has few features, less compared to DigitalOcean, which has been available for a few years. AWS, which has been available for even longer, is generally the gold standard–if you like, or need, a cloud platform with every conceivable tweakable option. You have to wonder what took GoDaddy so long. And, even with years to think about what to implement in order to compete with DigitalOcean and Amazon, it has at least one problem which the others don’t.

As I am currently a tepid fan of Dokku, I decided to check out how a GoDaddy VPS would perform compared to a VPS on DigitalOcean. However, I spent a day or two figuring out that GoDaddy has a problem with routing Docker container network traffic. You can see a discussion of the type of problem here, and a solution provided by GoDaddy here. The tweek involves some changes to iptables. Below is a script that wraps it all together: it installs Docker and fixes the iptables for a GoDaddy VPS. Enjoy!

#
sudo apt-get update -y
sudo apt-get install -y apt-transport-https ca-certificates
sudo apt-key adv --keyserver hkp://p80.pool.sks-keyservers.net:80 --recv-keys 58118E89F3A912897C070ADBF76221572C52609D
sudo bash -c 'echo deb https://apt.dockerproject.org/repo ubuntu-trusty main > /etc/apt/sources.list.d/docker.list'
sudo apt-get update -y
sudo apt-get purge lxc-docker
sudo apt-cache policy docker-engine
sudo apt-get install linux-image-extra-$(uname -r)
sudo apt-get install -y docker-engine
sudo service docker start
sudo docker run hello-world

# verify ping works
sudo docker run --rm -it ubuntu /bin/bash -c 'ping -c3 8.8.8.8'

# update iptable
export IP=`ip route get 8.8.8.8 | awk '{print $NF; exit}'`
sudo iptables -t nat -I POSTROUTING ! -o docker0 -j SNAT --to $IP
sudo iptables -t nat -I POSTROUTING -s 172.17.0.0/16 -d 208.109.188.8 ! -o docker0 -j SNAT --to $IP
sudo iptables -t nat -I POSTROUTING -s 172.17.0.0/16 -d 208.109.188.9 ! -o docker0 -j SNAT --to $IP

# verify ping works
sudo docker run --rm -it ubuntu /bin/bash -c 'ping -c3 8.8.8.8'

 

Posted in Tip