#!/bin/bash command_exists() { command -v "$@" > /dev/null 2>&1 } is_wsl() { case "$(uname -r)" in *microsoft* ) true ;; # WSL 2 *Microsoft* ) true ;; # WSL 1 * ) false;; esac } if is_wsl; then echo "检测到 WSL 环境,建议使用 Docker Desktop." exit 0 elif command_exists docker; then echo "Docker 已安装.... 跳过安装" else curl -sSL https://git.martin98.com/MartinFarm/init/raw/branch/main/docker-install.sh | sh cat > /etc/docker/daemon.json </dev/null 2>&1; then systemctl restart docker else echo "systemctl 不存在,跳过 docker 重启。" fi fi