-
Notifications
You must be signed in to change notification settings - Fork 1
/
docker.sh
57 lines (47 loc) · 1.34 KB
/
docker.sh
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
#!/bin/bash
# docker.sh
#
# Gokay Gurcan
# https://www.gokaygurcan.com/
# ----------------------------
set -e
# Set colors
BLACK=$(tput setaf 0)
RED=$(tput setaf 1)
GREEN=$(tput setaf 2)
YELLOW=$(tput setaf 3)
BLUE=$(tput setaf 4)
MAGENTA=$(tput setaf 5)
CYAN=$(tput setaf 6)
WHITE=$(tput setaf 7)
BOLD=$(tput bold)
RESET=$(tput sgr0)
# Detect OS
if [[ "$OSTYPE" == "linux"* ]]; then
OS="linux"
elif [[ "$OSTYPE" == "darwin"* ]]; then
OS="macos"
else
OS="other"
fi
echo "$RED ~ Detect : $GREEN ${OS} $RESET"
# Continue only if OS is linux, macos will follow later.
if [ $OS == "linux" ]; then
echo $BLUE $(uname -a) $RESET
else
echo "$RED Exiting.. $RESET"
exit 1
fi
echo "$RED ~ Install : $GREEN Packages and libraries $RESET"
sudo apt-get update && sudo apt-get upgrade -y
sudo apt-get install -y apt-transport-https ca-certificates linux-image-extra-$(uname -r) linux-image-extra-virtual linux-image-generic-lts-xenial
echo "$RED ~ Install : $GREEN Docker $RESET"
sudo wget -qO- https://get.docker.com/ | sh
echo "$RED ~ Configuration : $GREEN Add user to the Docker group $RESET"
sudo usermod -aG docker $(whoami)
echo "$RED ~ Service : $GREEN Start Docker service $RESET"
sudo service docker start
echo "$RED ~ Install : $GREEN Docker Compose $RESET"
sudo apt-get -y install python-pip
sudo pip install --upgrade pip
sudo pip install docker-compose