Skip to content

Instantly share code, notes, and snippets.

@rochacon
Created July 1, 2014 01:40
Show Gist options
  • Save rochacon/8954fbfe4a667514c49f to your computer and use it in GitHub Desktop.
Save rochacon/8954fbfe4a667514c49f to your computer and use it in GitHub Desktop.
Simple userdata to install and configure a Docker node
#!/bin/bash
# This will install the latest version of Docker and configure it to
# listen to /var/run/docker.sock and 0.0.0.0:2375
ufw allow ssh
ufw limit ssh
ufw enable
apt-get update -y && apt-get upgrade -yq
curl -s https://get.docker.io/ubuntu/ | sh
sed -i .bak -e 's/^DEFAULT_FORWARD_POLICY.*$/DEFAULT_FORWARD_POLICY="ACCEPT"/g' /etc/default/ufw
ufw reload
usermod -a -G docker ubuntu
cp /etc/default/docker{,.bak}
echo 'DOCKER_OPTS="-H unix:///var/run/docker.sock -H tcp://0.0.0.0:2375"' | tee /etc/default/docker
restart docker
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment