Ultima attività 1759311426

Revisione 2b00fd1dcb91826038f1a72e29514afd0aafe5e4

ol9-docker Raw
1#!/bin/bash
2set -e
3
4echo "[+] Installing Docker CE on Oracle Linux 9..."
5/usr/bin/timedatectl set-timezone Europe/Moscow
6
7# Enable required repos
8echo "[+] Enabling required Oracle Linux repositories..."
9dnf install -y dnf-plugins-core oraclelinux-developer-release-el9 tmux nano openssh-server git
10dnf config-manager --enable ol9_developer
11
12echo '[*] Enabling root SSH login...'
13sudo sed -i 's/^#\?PermitRootLogin .*/PermitRootLogin yes/' /etc/ssh/sshd_config || echo 'PermitRootLogin yes' | sudo tee -a /etc/ssh/sshd_config
14curl https://gist.zubovspace.com/dszubov/2a97f1f8d4764a7eaf9dc5704735f094/raw/HEAD/sshd_config > /etc/ssh/sshd_config
15sudo systemctl restart sshd
16sudo systemctl enable sshd
17
18# Install container-selinux
19echo "[+] Installing container-selinux..."
20dnf install -y container-selinux
21
22# Disabling firewall and selinux
23setenforce 0
24systemctl stop firewalld
25systemctl disable firewalld
26
27# Add Docker CE repo
28echo "[+] Adding Docker CE repo..."
29dnf install -y dnf-utils
30dnf config-manager --add-repo https://download.docker.com/linux/centos/docker-ce.repo
31
32# Install Docker CE and plugins
33echo "[+] Installing Docker CE and plugins..."
34dnf install -y docker-ce docker-ce-cli containerd.io docker-buildx-plugin docker-compose-plugin
35
36# Enable and start Docker
37echo "[+] Enabling and starting Docker service..."
38systemctl enable --now docker
39
40# Optional: add current user to docker group
41if [ "$SUDO_USER" ]; then
42 echo "[+] Adding $SUDO_USER to docker group..."
43 usermod -aG docker "$SUDO_USER"
44fi
45
46echo "[+] Docker installation complete!"
47echo ">> Run 'docker run hello-world' to test it"