Skip to content

Instantly share code, notes, and snippets.

@lemmycaution
Last active August 29, 2015 13:56
Show Gist options
  • Save lemmycaution/9040507 to your computer and use it in GitHub Desktop.
Save lemmycaution/9040507 to your computer and use it in GitHub Desktop.
#!/usr/bin/env bash
user="$1"
if [ -z "$user" ]; then
user=ubuntu
fi
# Enable memory cgroup and swap accounting
sed -i 's/GRUB_CMDLINE_LINUX=""/GRUB_CMDLINE_LINUX="cgroup_enable=memory swapaccount=1"/g' /etc/default/grub
update-grub
# Adding an apt gpg key is idempotent.
apt-key adv --keyserver keyserver.ubuntu.com --recv-keys 36A1D7869245C8950F966E92D8576A8BA88D21E9
echo 'deb http://get.docker.io/ubuntu docker main' > /etc/apt/sources.list.d/docker.list
# Update remote package metadata. 'apt-get update' is idempotent.
apt-get update -q
# Install docker. 'apt-get install' is idempotent.
apt-get install -q -y lxc-docker
usermod -a -G docker "$user"
apt-get install -q -y linux-image-generic-lts-raring linux-headers-generic-lts-raring
# docker-registry
registry=$(sudo docker run -d -p 5000:5000 registry)
echo "registry container id: $registry"
echo "Rebooting down to activate new kernel."
shutdown -r now
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment