#!/usr/bin/env bash # ============================================================================== # Metadata # ============================================================================== # Author : Smith Wang (Refactor by ChatGPT) # Version : 2.0.0 # License : MIT # Description : Configure Docker APT repository (mirror) and install Docker on # Ubuntu (18.04/20.04/22.04/24.04) with robust offline handling. # # Modules : # - Logging & Error Handling # - Environment & Dependency Checks # - Public Network Reachability Detection # - Docker GPG Key Installation (Online/Offline) # - Docker APT Repo Configuration # - Docker Installation & Service Setup # # Notes : # - This script DOES NOT modify Ubuntu APT sources (/etc/apt/sources.list) # - This script DOES NOT set APT proxy (assumed handled elsewhere) # - If public network is NOT reachable and local GPG key is missing, script # will NOT proceed (per your requirement). # # ShellCheck : Intended clean for bash v5+ with: shellcheck -x