Created
February 8, 2017 16:29
-
-
Save bhdrk/d0381fb170443991517bc61f7bb42a88 to your computer and use it in GitHub Desktop.
Install Docker on Ubuntu (Trusty 14.04, Xenial 16.04, Yakkety 16.10)
This file contains hidden or 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 Docker on Ubuntu - | |
# | |
# Prerequisites: | |
# | |
# Yakkety 16.10 | |
# Xenial 16.04 (LTS) | |
# Trusty 14.04 (LTS) | |
# | |
set -e | |
# Ensure script is running as root | |
if [ "$EUID" -ne 0 ] | |
then echo "WARN: Please run as root (sudo)" | |
exit 1 | |
fi | |
# Install required tools | |
apt-get install -y \ | |
curl \ | |
linux-image-extra-$(uname -r) \ | |
linux-image-extra-virtual | |
# Step 1 | |
apt-get install -y \ | |
apt-transport-https \ | |
ca-certificates | |
# Step 2 | |
curl -fsSL https://yum.dockerproject.org/gpg | sudo apt-key add - | |
# Step 3 | |
apt-get install -y \ | |
software-properties-common | |
add-apt-repository \ | |
"deb https://apt.dockerproject.org/repo/ \ | |
ubuntu-$(lsb_release -cs) \ | |
main" | |
# Step 4 | |
apt-get update -y | |
apt-get -y install docker-engine | |
# Check Docker Daemon | |
docker version && { echo "OK: Docker daemon started successfully." >&2; exit 0; } || { echo "ERROR: Somethings went wrong. Docker daemon cannot be started." >&2; exit 1; } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment