-
Notifications
You must be signed in to change notification settings - Fork 16
Expand file tree
/
Copy pathdocker.sh
More file actions
52 lines (44 loc) · 1.51 KB
/
Copy pathdocker.sh
File metadata and controls
52 lines (44 loc) · 1.51 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
#!/bin/bash
# Author: Benjamin
# Date: December 2020
## This script is for installing Docker on Centos7
## Docker is a containerization software used to create and manage containers. To use docker containers, you must first of all install Docker on your system.
## First, you need to boot up a Centos 7 server and connect remotely to it.
# _________________________________ Docker Installation _______________________________________________
# Cleaning up the system
echo "Welcome to Docker installation. Please wait ...."
sleep 2
sudo yum remove docker docker-client docker-client-latest docker-common docker-latest docker-latest-logrotate docker-logrotate docker-engine
# Setting up the docker repository
sudo yum install -y yum-utils
if [ $? -ne 0 ]
then
echo "Docker installation failed. Please read the error message."
exit 1
fi
sudo yum-config-manager --add-repo https://download.docker.com/linux/centos/docker-ce.repo
if [ $? -ne 0 ]
then
echo "Docker installation failed. Please read the error message."
exit 2
fi
# Installing the docker engine
sudo yum install docker-ce docker-ce-cli containerd.io
if [ $? -ne 0 ]
then
echo "Docker installation failed. Please read the error message."
exit 3
fi
# Checking the status, starting and enabling docker daemon
sudo systemctl status docker
sudo systemctl start docker
sudo systemctl enable docker
if [ $? -ne 0 ]
then
echo "Docker installation failed. Please read the error message."
exit 4
fi
sudo systemctl status docker
sleep 2
clear
echo " Docker has been successfully installed"