This repository was archived by the owner on Jan 12, 2022. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 4
Expand file tree
/
Copy pathsetup.sh
More file actions
executable file
·75 lines (64 loc) · 2.81 KB
/
setup.sh
File metadata and controls
executable file
·75 lines (64 loc) · 2.81 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
#!/usr/bin/env bash
#
# Simple script to setup the docker host
# Version: 0.1
#
# Set strict mode
set -euo pipefail
# Default verbosity, common levels are 0,1,5,10
verbosity="${verbosity:-1}"
# Include stdlib from the lib directory
# shellcheck disable=SC1091
source lib/shtdlib/shtdlib.sh
# Print some useful information
color_echo cyan "Detected OS type: ${os_type}"
color_echo cyan "Detected OS family: ${os_family}"
color_echo cyan "Detected OS name: ${os_name}"
color_echo cyan "Detected OS major version: ${major_version}"
color_echo cyan "Detected OS minor version: ${minor_version}"
color_echo cyan "Setting up Docker host"
case ${os_family} in
"RedHat")
if [ "${major_version}" -ge 7 ] ; then
# Optional
yum install -y yum-utils device-mapper-persistent-data lvm2
yum-config-manager --add-repo https://download.docker.com/linux/centos/docker-ce.repo
yum install -y docker-ce
systemctl enable docker.service
systemctl start docker.service
systemctl status docker.service
yum install https://dl.fedoraproject.org/pub/epel/epel-release-latest-7.noarch.rpm
yum install -y python2-pip
pip install docker-compose
fi
;;
"Debian")
if [ "${major_version}" -ge 16 ] ; then
# Remove baked in kubernetes apt repo if it exists
[[ -f /etc/apt/sources.list.d/apt_kubernetes_io.list ]] && rm /etc/apt/sources.list.d/apt_kubernetes_io.list
# OR add the apt key if you need it
# [[ -f /etc/apt/sources.list.d/apt_kubernetes_io.list ]] && apt-key adv --keyserver keyserver.ubuntu.com --recv-keys 6A030B21BA07F4FB
# Dependencies
apt-get update
apt-get install -y apt-transport-https ca-certificates curl software-properties-common
# Apt key
curl -fsSL https://download.docker.com/linux/ubuntu/gpg | apt-key add -
apt-key fingerprint 0EBFCD88
# Remove legacy docker, add repo, install latest docker
apt-get remove -y docker docker-engine docker.io
add-apt-repository "deb [arch=amd64] https://download.docker.com/linux/ubuntu $(lsb_release -cs) stable"
apt-get update
apt-get install -y docker-ce
systemctl enable docker.service
systemctl start docker.service
# Docker compose
curl -L "https://github.com/docker/compose/releases/download/1.21.0/docker-compose-$(uname -s)-$(uname -m)" -o /usr/local/bin/docker-compose
chmod +x /usr/local/bin/docker-compose
docker-compose --version
fi
;;
*)
color_echo red "Unable to determine operating system or OS family (${os_family}) is not supported yet!"
exit 1
;;
esac