Created
February 7, 2016 09:20
-
-
Save maxfi/5a155f84314220563f7f to your computer and use it in GitHub Desktop.
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 | |
# Install and configure docker. | |
# Based on https://docs.docker.com/engine/installation/linux/ubuntulinux/. | |
# ------------------------------------------------------------------------ | |
# ------------------ | |
# Script setup | |
# ------------------ | |
# Exit on failure. | |
set -e | |
# Check for root. | |
if [ "$EUID" -ne 0 ] | |
then echo "Please run as root" | |
exit | |
fi | |
# ------------------------ | |
# Update apt sources | |
# ------------------------ | |
# Update package information, ensure that APT works with the https method, and that CA certificates are installed. | |
apt-get update | |
apt-get install -y apt-transport-https ca-certificates | |
# Add the new GPG key. | |
apt-key adv --keyserver hkp://p80.pool.sks-keyservers.net:80 --recv-keys 58118E89F3A912897C070ADBF76221572C52609D | |
# Update docker apt sources. | |
RELEASE_CODENAME=$(lsb_release --codename | cut -f2) | |
echo "deb https://apt.dockerproject.org/repo ubuntu-$RELEASE_CODENAME main" > /etc/apt/sources.list.d/docker.list | |
# Update the APT package index. | |
apt-get update | |
# Purge the old repo if it exists. | |
apt-get purge lxc-docker | |
# Verify that APT is pulling from the right repository. | |
apt-cache policy docker-engine | |
# ----------- | |
# Install | |
# ----------- | |
# Install prerequisites. | |
# apt-get install linux-image-extra-$(uname -r) | |
# Install docker. | |
apt-get install -y docker-engine | |
# Start the docker daemon. | |
sudo service docker start | |
# Verify docker is installed correctly. | |
docker run hello-world |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment