Skip to content

Instantly share code, notes, and snippets.

@scry3r
Last active October 21, 2017 17:24
Show Gist options
  • Save scry3r/9214033a90af6a2d87fd574a018c2d40 to your computer and use it in GitHub Desktop.
Save scry3r/9214033a90af6a2d87fd574a018c2d40 to your computer and use it in GitHub Desktop.
Install docker
#!/bin/bash
set -eu -o pipefail # fail on error , debug all lines
# run as root
[ "$USER" = "root" ] || exec sudo "$0" "$@"
echo "=== $BASH_SOURCE on $(hostname -f) at $(date)" >&2
err_msg="\n\nthis script is only for Ubuntu 17.04 zesty, BUT you have: \n"$(lsb_release -a)
test $(lsb_release -cs) != "zesty" && echo -e "$err_msg"
test $(lsb_release -cs) != "zesty" && exit 1
echo Install Using the Repository
echo Update the apt package index:
apt-get update
echo Install packages to allow apt to use a repository over HTTPS:
apt-get install -y \
apt-transport-https \
ca-certificates \
curl \
software-properties-common
echo Add Docker official GPG key:
curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo apt-key add -
echo Verify that the key fingerprint is 9DC8 5822 9FC7 DD38 854A E2D8 8D81 803C 0EBF CD88.
apt-key fingerprint 0EBFCD88
echo << EOF_STDOUT
# the output should look like :
#
# pub 4096R/0EBFCD88 2017-02-22
# Key fingerprint = 9DC8 5822 9FC7 DD38 854A E2D8 8D81 803C 0EBF CD88
# uid Docker Release (CE deb) <docker@docker.com>
# sub 4096R/F273FCD8 2017-02-22
EOF_STDOUT
echo Use the following command to set up the stable repository for the amd64 architecture
arch=$(dpkg --print-architecture)
add-apt-repository \
"deb [arch=""$arch""] https://download.docker.com/linux/ubuntu \
$(lsb_release -cs) \
stable"
echo INSTALL DOCKER CE
sudo apt-get update
sudo apt-get install -y docker-ce
echo the docker binary is installed in
which docker
echo DONE !!!
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment