-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathinstall-docker.sh
executable file
·65 lines (42 loc) · 1.39 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
55
56
57
58
59
60
61
#!/bin/bash
# Docker CE for Linux installation script
#
# See https://docs.docker.com/engine/install/ for the installation steps.
command_exists() {
command -v "$@" > /dev/null 2>&1
}
do_install(){
user="$(id -un 2>/dev/null || true)"
sh_c='sh -c'
if [ "$user" != 'root' ]; then
if command_exists sudo; then
sh_c='sudo -E sh -c'
elif command_exists su; then
sh_c='su -c'
else
cat >&2 <<-'EOF'
Error: this installer needs the ability to run commands as root.
We are unable to find either "sudo" or "su" available to make this happen.
EOF
exit 1
fi
fi
echo "# Downloading Docker CE [get-docker.sh] for Linux installation script from https://get.docker.com\n"
# NOTE: Make sure to verify the contents of the script
# you downloaded matches the contents of install.sh
# located at https://github.com/docker/docker-install
# before executing.
# $sh_c 'curl -fsSL https://get.docker.com -o get-docker.sh > /dev/null'
# $sh_c 'chmod +x get-docker.sh'
# ./get-docker.sh
# $sh_c 'clear'
# $sh_c 'rm -rm get-docker.sh'
# Add current user to docker group so there is no need to use sudo when running docker
# $sh_c "usermod -aG docker $(whoami')"
# Verify docker installation by checking the docker version
# $sh_c 'systemctl enable docker'
# Enable docker service
# $sh_c 'systemctl enable docker'
# Start docker service
# $sh_c 'systemctl start docker'
}