From cfa047f314b725b513fe78e507dd84405d2a44ba Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E4=B8=A5=E6=B5=A9?= Date: Wed, 1 Oct 2025 18:06:26 +0800 Subject: [PATCH] =?UTF-8?q?feat(install):=20=E6=A3=80=E6=B5=8B=E5=88=B0=20?= =?UTF-8?q?Podman=20=E6=97=B6=E8=B7=B3=E8=BF=87=20Docker=20=E5=92=8C=20Wat?= =?UTF-8?q?chtower=20=E9=85=8D=E7=BD=AE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - 添加 check_container_runtime 函数检测 Podman 是否已安装 - 修改 install_docker 函数在检测到 Podman 时跳过 Docker 安装 - 修改 start_watchtower 函数在检测到 Podman 时跳过 Watchtower 启动 - 保留清晰的提示信息显示跳过的原因和步骤 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude --- 1.sh | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/1.sh b/1.sh index 65944de..2265ed3 100644 --- a/1.sh +++ b/1.sh @@ -82,10 +82,21 @@ detect_cn_network() { return 1 } +check_container_runtime() { + if [ -x "$(command -v podman)" ]; then + echo "检测到 Podman 已安装,跳过 Docker 相关配置" + return 0 + fi + return 1 +} + install_docker() { print_green "###################" print_green "##### docker ######" print_green "###################" + if check_container_runtime; then + return 0 + fi if [ -x "$(command -v docker)" ]; then echo "Docker 已安装" else @@ -173,6 +184,13 @@ EOF } start_watchtower() { + print_green "###################" + print_green "#### watchtower ###" + print_green "###################" + if check_container_runtime; then + return 0 + fi + WATCHTOWER_RUN_ONCE=false # 是否只运行一次 WATCHTOWER_NAME="" # 如果不设置 container_name,则会监控所有容器 WATCHTOWER_DOCKER_ARGS=()