-
-
Save ns408/32754bbb570a5a70afdcc7b8bd617254 to your computer and use it in GitHub Desktop.
Script to install Docker on a Ubuntu 13.04 host
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#/bin/bash | |
set -e | |
echo "=== Activating Firewall (only SSH allowed) ===" | |
ufw allow ssh | |
ufw --force enable | |
if [ ! -f /swapfile ]; then | |
echo "=== Activating swap ===" | |
fallocate -l 1G /swapfile | |
mkswap /swapfile | |
swapon /swapfile | |
chmod 0600 /swapfile | |
echo "/swapfile none swap sw 0 0" >> /etc/fstab | |
fi | |
echo "=== Installing Kernel with LXC and AUFS Support ===" | |
export DEBIAN_FRONTEND=noninteractive | |
apt-get -qq update | |
apt-get install -qqy linux-image-extra-`uname -r` | |
echo "=== Installing Docker and git ===" | |
curl http://get.docker.io/gpg | apt-key add - | |
echo deb https://get.docker.io/ubuntu docker main > /etc/apt/sources.list.d/docker.list | |
apt-get -qq update | |
apt-get install -qqy lxc-docker git | |
echo "=== Opening Firewall for Docker Network ===" | |
sed -i.bak 's/DEFAULT_FORWARD_POLICY=".*"/DEFAULT_FORWARD_POLICY="ACCEPT"/' /etc/default/ufw | |
sed -r -i.bak 's/^#(net\/ipv4\/ip_forward=1|net\/ipv6\/conf\/default\/forwarding=1|net\/ipv6\/conf\/all\/forwarding=1)$/\1/' /etc/ufw/sysctl.conf | |
ufw disable | |
ufw --force enable | |
ufw allow out on docker0 | |
ufw allow in on docker0 | |
echo "=== Verifying Installation ===" | |
docker run busybox /bin/echo '*** It works! ***' |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment