-
-
Notifications
You must be signed in to change notification settings - Fork 2.1k
/
bootstrap.sh
76 lines (64 loc) · 1.66 KB
/
bootstrap.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
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
#!/bin/bash
## This is a master script for all Linux & Windows Operating System which will install Docker and Docker Compose on various distros like Ubuntu, Debian,
## Scientific Linux, FreeBSD, Asianux, Alpine and many more
prepare_ubuntu() {
sudo apt-get update
sudo apt-get dist-upgrade -y
sudo apt-get install -y --no-install-recommends \
apt-transport-https \
curl \
gnupg-curl \
htop \
lsof \
tree \
tzdata \
lsb-release \
bzip2 \
unzip \
xz-utils
}
install_docker() {
# Docker
export CHANNEL=stable
curl -fsSL https://get.docker.com/ | sh
## Add Docker daemon configuration
cat <<EOF | sudo tee /etc/docker/daemon.json
{
"icc": false,
"disable-legacy-registry": true,
"userland-proxy": false,
"live-restore": true
}
EOF
## Start docker service
sudo systemctl enable docker
sudo systemctl start docker
## Add current user to docker group
sudo usermod -aG docker $USER
## show information
docker version
docker info
}
prepare_compose(){
# Docker Compose
sudo curl -L https://github.com/docker/compose/releases/download/1.21.0-rc1/docker-compose-`uname -s`-`uname -m` -o /usr/local/bin/docker-compose
sudo chmod +x /usr/local/bin/docker-compose
## show docker-compose version
docker-compose version
}
provision_docker() {
echo "Provisioning ..."
prepare_ubuntu
install_docker
# Downlaod the Dockerfile and docker-compose.yml
}
provision_compose(){
echo "Provisioning Docker Compose .."
prepare_compose
}
command=$1
shift
case "$command" in
provision_docker) provision_docker $@ ;;
*) echo "Usage: <logs|provision_docker|provision_compose>" ;;
esac