Skip to content

Instantly share code, notes, and snippets.

@pascalandy
Last active October 28, 2016 14:55
Show Gist options
  • Save pascalandy/072793177309f2f151aad9ea01a3b42a to your computer and use it in GitHub Desktop.
Save pascalandy/072793177309f2f151aad9ea01a3b42a to your computer and use it in GitHub Desktop.
to analyse - install-docker.sh
#!/bin/sh
# option 2: paste this into user-data to automate install via boot script
# NOTE: update --label=owner=YOURNAME below if you want to easily identify yours
apt-key adv --keyserver hkp://p80.pool.sks-keyservers.net:80 --recv-keys 58118E89F3A912897C070ADBF76221572C52609D
mkdir -p /etc/apt/sources.list.d
echo deb https://apt.dockerproject.org/repo ubuntu-xenial main > /etc/apt/sources.list.d/docker.list
printf 'net.ipv4.neigh.default.gc_thresh1 = 30000\nnet.ipv4.neigh.default.gc_thresh2 = 32000\nnet.ipv4.neigh.default.gc_thresh3 = 32768' >> /etc/sysctl.conf
sysctl -p
service lxcfs stop
apt-get remove -y -q lxc-common lxcfs lxd lxd-client
apt-get update -q
apt-get install -y -q linux-image-extra-$(uname -r) linux-image-extra-virtual
apt-get install -y -q docker-engine=1.12.3*
systemctl start docker.service
mkdir -p /etc/systemd/system/docker.service.d
printf '[Service]\nExecStart=\nExecStart=/usr/bin/dockerd -H fd:// --label=owner=YOURNAME --storage-driver aufs' > /etc/systemd/system/docker.service.d/options.conf
systemctl daemon-reload
systemctl restart docker.service
docker swarm join \
--advertise-addr $(curl http://169.254.169.254/latest/meta-data/public-ipv4) \
--token SWMTKN-1-29tx6z2k8zmsbt9z2c2ay54jc9ce2l94ixhmmagveifv3pp4fa-5e8i9gugpb9b4bmi9vrp7m5su \
67.205.160.45:2377
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment