feat(install): 检测到 Podman 时跳过 Docker 和 Watchtower 配置

- 添加 check_container_runtime 函数检测 Podman 是否已安装
- 修改 install_docker 函数在检测到 Podman 时跳过 Docker 安装
- 修改 start_watchtower 函数在检测到 Podman 时跳过 Watchtower 启动
- 保留清晰的提示信息显示跳过的原因和步骤

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
严浩
2025-10-01 18:06:26 +08:00
parent 992ed1ecc1
commit cfa047f314

18
1.sh
View File

@@ -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=()