#!/bin/bash set -e echo "[+] Installing Docker CE on Oracle Linux 9..." # Enable required repos echo "[+] Enabling required Oracle Linux repositories..." dnf install -y dnf-plugins-core oraclelinux-developer-release-el9 tmux nano openssh-server dnf config-manager --enable ol9_developer echo '[*] Enabling root SSH login...' sudo sed -i 's/^#\?PermitRootLogin .*/PermitRootLogin yes/' /etc/ssh/sshd_config || echo 'PermitRootLogin yes' | sudo tee -a /etc/ssh/sshd_config sudo systemctl restart sshd sudo systemctl enable sshd # Install container-selinux echo "[+] Installing container-selinux..." dnf install -y container-selinux # Add Docker CE repo echo "[+] Adding Docker CE repo..." dnf install -y dnf-utils dnf config-manager --add-repo https://download.docker.com/linux/centos/docker-ce.repo # Install Docker CE and plugins echo "[+] Installing Docker CE and plugins..." dnf install -y docker-ce docker-ce-cli containerd.io docker-buildx-plugin docker-compose-plugin # Enable and start Docker echo "[+] Enabling and starting Docker service..." systemctl enable --now docker # Optional: add current user to docker group if [ "$SUDO_USER" ]; then echo "[+] Adding $SUDO_USER to docker group..." usermod -aG docker "$SUDO_USER" fi echo "[+] Docker installation complete!" echo ">> Run 'docker run hello-world' to test it"