forked from jainrahul1234/docker-lab
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathinstallDocker.sh
More file actions
executable file
·40 lines (32 loc) · 1.27 KB
/
installDocker.sh
File metadata and controls
executable file
·40 lines (32 loc) · 1.27 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
#!/bin/bash
## Remove any pre installed docker packages :
sudo apt-get remove -y docker docker-engine docker.io docker-ce
cd /var/lib
rm -r docker
rm `which docker-compose`
rm `which docker-machine`
## Install using the repository:
sudo apt-get update
sudo apt-get install -y apt-transport-https ca-certificates curl software-properties-common
## Add Dockers official GPG key
curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo apt-key add -
sudo add-apt-repository "deb [arch=amd64] https://download.docker.com/linux/ubuntu $(lsb_release -cs) stable"
## Install Docker latest
sudo apt-get update ; clear
echo "starting the installation of docker-ce ...."
echo "Available Version for Install"
echo " "
apt-cache madison docker-ce | awk '{print $3}'
echo " "
read -p 'Enter Required Version: ' version
sudo apt-get install -y docker-ce=$version
sudo service docker start
echo "starting the installation of docker-compose ...."
echo " "
sudo curl -L https://github.com/docker/compose/releases/download/1.23.2/docker-compose-`uname -s`-`uname -m` -o /usr/local/bin/docker-compose
sudo chmod +x /usr/local/bin/docker-compose
echo " "
echo "Validating the versions Installed"
echo "`docker -v` - is installed Successfully"
echo "`docker-compose -v` - is installed Successfully"
exit 0