-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathinstall-docker
33 lines (30 loc) · 987 Bytes
/
install-docker
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
#!/bin/bash
## local variables
DOCKER_VERSION="$1"
## install docker
if [ ! -x "$(command -v docker)" ];
then
if uname -a | grep Ubuntu;
then
sudo apt-get -y install apt-transport-https \
ca-certificates \
curl \
software-properties-common
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"
sudo apt-get -y update
sudo apt-get -y install docker-ce="$DOCKER_VERSION"
else
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-${DOCKER_VERSION}"
fi
fi
## ensure docker started
sudo service docker start
sudo systemctl start docker