Skip to content

Instantly share code, notes, and snippets.

@shichao-an
Last active August 29, 2015 14:15
Show Gist options
  • Save shichao-an/6d8909d75aed282129ef to your computer and use it in GitHub Desktop.
Save shichao-an/6d8909d75aed282129ef to your computer and use it in GitHub Desktop.
Install Docker on Ubuntu 14.04 with UFW
#!/bin/bash
set -e
apt-get update
# Install iptables-persistent
apt-get install -y iptables-persistent
# Enable UFW forwarding and open TCP port 2375
ufw enable
sed -i 's/\(DEFAULT_FORWARD_POLICY\)="DROP"/\1="ACCEPT"/g' /etc/default/ufw
ufw allow 22/tcp 2375/tcp
ufw reload
# Save iptables ruls
service iptables-persistent save
# Install docker and dependencies
[ -e /usr/lib/apt/methods/https ] || {
apt-get update
apt-get install apt-transport-https
}
apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 \
--recv-keys 36A1D7869245C8950F966E92D8576A8BA88D21E9
curl -sSL https://get.docker.com/ubuntu/ | sh
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment