-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdocker_install.sh
More file actions
56 lines (42 loc) · 1.31 KB
/
docker_install.sh
File metadata and controls
56 lines (42 loc) · 1.31 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
#!/bin/bash
# ---
# Deploy Docker with Docker-Compose on CentOS7
# V 0.1 - 2017-12-13 Initial version
# ---
LUID=$(id -u)
if [ $LUID -eq 0 ]; then
error "Error : you must use an user not the root account"
exit 1
fi
if [ -z $1 ]; then
echo "Error : You must specify an user name on the command line."
exit 1
fi
if [ -z `grep ${1} /etc/passwd` ]; then
echo "Error : The user does not exist."
exit 1
fi
sudo groupadd docker
sudo timedatectl set-timezone Europe/Paris
sudo timedatectl
sudo yum install -y ntp
sudo systemctl start ntpd
sudo systemctl enable ntpd
# Install tools
sudo yum install -y git wget
# Suppression des anciennes versions
sudo yum remove docker docker-common docker-selinux docker-engine
# Installation outils
sudo yum install -y yum-utils device-mapper-persistent-data lvm2
sudo yum-config-manager --add-repo https://download.docker.com/linux/centos/docker-ce.repo
sudo yum install -y docker-ce
sudo usermod -aG docker ${1}
# Starting Docker
sudo systemctl start docker
# Testing Docker with the Hello-World docker
docker run hello-world
# Install docker compose
sudo curl -L https://github.com/docker/compose/releases/download/1.17.0/docker-compose-`uname -s`-`uname -m` -o /usr/local/bin/docker-compose
sudo chmod +x /usr/local/bin/docker-compose
docker-compose --version
echo "*** End of process"