-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathInstall-DockerEngine.bash
executable file
·42 lines (33 loc) · 1.05 KB
/
Install-DockerEngine.bash
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
#!/bin/bash
# Importing function run_as_root and get_os_type
source RunAsRoot.bash
source OsInfo.bash
# Running as root
run_as_root
# Installing requirements
dnf install --assumeyes dnf-plugins-core
# Getting OS Type
os_type="$(get_os_type)"
if [ "$os_type" == "almalinux" ] || [ "$os_type" == "ol" ]; then
os_type="rhel"
fi
# Adding Docker repository
if [ "$(command -v dnf4)" ]; then
dnf4 config-manager --assumeyes --add-repo "https://download.docker.com/linux/${os_type}/docker-ce.repo"
else
dnf config-manager --assumeyes --add-repo "https://download.docker.com/linux/${os_type}/docker-ce.repo"
fi
# Installing Docker Engine
dnf install --allowerasing --assumeyes docker-ce docker-ce-cli containerd.io docker-buildx-plugin docker-compose-plugin
# Enabling Docker
systemctl enable --now docker containerd.service
# Adding user group
groupadd docker
usermod -aG docker "$SUDO_USER"
# Configuring to run in rootless mode
sh -eux <<EOF
# Load ip_tables module
modprobe ip_tables
EOF
setenforce 0
sudo -u "$SUDO_USER" dockerd-rootless-setuptool.sh install