-
Notifications
You must be signed in to change notification settings - Fork 5
/
install-docker.sh
54 lines (46 loc) · 1.16 KB
/
install-docker.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
#!/bin/bash -e
if [[ $EUID -ne 0 ]]; then
echo "This script must be run as root"
exit 1
fi
# Save input arguments for debug and diagnosis
echo "Running: $0 $@" >> .install.log
# Set defaults
#USER=${1:-$SUDO_USER}
DCKRV=${2:-5:20.10.8~3-0~ubuntu-bionic}
docker_install()
{
apt update
apt install -y apt-transport-https ca-certificates gnupg-agent software-properties-common curl
curl -fsSL https://download.docker.com/linux/ubuntu/gpg | apt-key add -
add-apt-repository \
"deb [arch=amd64] https://download.docker.com/linux/ubuntu \
$(lsb_release -cs) \
stable"
apt update
apt install -y docker-ce=$DCKRV docker-ce-cli=$DCKRV containerd.io
}
docker_add_group()
{
usermod -aG docker ubuntu
}
#docker_customize()
#{
# Nice to have: make sure if dockerd is restarted it won't kill k8s
# cat <<EOF >/etc/docker/daemon.json
#{
# "live-restore": true,
# "storage-driver": "overlay2"
#}
#EOF
# systemctl restart docker.service
# systemctl enable docker.service
#}
docker_install $DCKRV
docker_add_group
docker info
echo
echo "#################################"
echo "# Docker Installation complete #"
echo "#################################"
echo