mirror of
https://github.com/lkddi/dell-fans-controller-docker.git
synced 2026-05-18 13:47:27 +08:00
改用Debian slim提升IPMI兼容性
This commit is contained in:
+1
-1
@@ -8,7 +8,7 @@
|
|||||||
- 移除代码中的默认 iDRAC 地址、账号和密码,改为必须通过环境变量配置。
|
- 移除代码中的默认 iDRAC 地址、账号和密码,改为必须通过环境变量配置。
|
||||||
- 增加 `.env.example`、`.dockerignore` 和 MIT License。
|
- 增加 `.env.example`、`.dockerignore` 和 MIT License。
|
||||||
- 清理 Python 缓存文件,避免将运行产物提交到仓库。
|
- 清理 Python 缓存文件,避免将运行产物提交到仓库。
|
||||||
- Docker 运行镜像切换到 Alpine,只安装 `python3`、`ipmitool` 和时区数据,降低镜像体积。
|
- Docker 运行镜像切换到 Debian slim,只安装 `python3`、`ipmitool` 和时区数据,在降低体积的同时保留更好的IPMI兼容性。
|
||||||
|
|
||||||
## Previous Improvements
|
## Previous Improvements
|
||||||
|
|
||||||
|
|||||||
+8
-5
@@ -1,16 +1,19 @@
|
|||||||
FROM alpine:3.20
|
FROM debian:bookworm-slim
|
||||||
LABEL maintainer="lkddi"
|
LABEL maintainer="lkddi"
|
||||||
|
|
||||||
ENV TZ=Asia/Shanghai \
|
ENV DEBIAN_FRONTEND=noninteractive \
|
||||||
|
TZ=Asia/Shanghai \
|
||||||
PYTHONDONTWRITEBYTECODE=1 \
|
PYTHONDONTWRITEBYTECODE=1 \
|
||||||
PYTHONUNBUFFERED=1
|
PYTHONUNBUFFERED=1
|
||||||
|
|
||||||
# 安装运行所需的最小依赖并设置容器时区
|
# 安装运行所需的最小Debian依赖并设置容器时区,兼顾体积和ipmitool兼容性
|
||||||
RUN apk add --no-cache \
|
RUN apt-get update \
|
||||||
|
&& apt-get install -y --no-install-recommends \
|
||||||
ipmitool \
|
ipmitool \
|
||||||
python3 \
|
python3 \
|
||||||
tzdata \
|
tzdata \
|
||||||
&& cp /usr/share/zoneinfo/${TZ} /etc/localtime \
|
&& rm -rf /var/lib/apt/lists/* \
|
||||||
|
&& ln -sf /usr/share/zoneinfo/${TZ} /etc/localtime \
|
||||||
&& echo "${TZ}" > /etc/timezone
|
&& echo "${TZ}" > /etc/timezone
|
||||||
|
|
||||||
# 只复制运行所需源码,避免文档和仓库元数据进入镜像
|
# 只复制运行所需源码,避免文档和仓库元数据进入镜像
|
||||||
|
|||||||
+2
-1
@@ -25,7 +25,8 @@ class IpmiTool:
|
|||||||
result = subprocess.run(command, shell=True, capture_output=True, text=True, timeout=60) # 增加超时时间
|
result = subprocess.run(command, shell=True, capture_output=True, text=True, timeout=60) # 增加超时时间
|
||||||
|
|
||||||
if result.returncode != 0:
|
if result.returncode != 0:
|
||||||
error_msg = result.stderr.strip()
|
# 部分ipmitool版本会把错误输出到stdout,或只返回退出码但stderr为空
|
||||||
|
error_msg = result.stderr.strip() or result.stdout.strip() or f'命令退出码: {result.returncode}'
|
||||||
# 检查是否是网络连接问题
|
# 检查是否是网络连接问题
|
||||||
if "Unable to establish IPMI" in error_msg or "session" in error_msg:
|
if "Unable to establish IPMI" in error_msg or "session" in error_msg:
|
||||||
logger.warning(f'IPMI会话建立失败 (尝试 {attempt + 1}/{retry_count}): {error_msg}')
|
logger.warning(f'IPMI会话建立失败 (尝试 {attempt + 1}/{retry_count}): {error_msg}')
|
||||||
|
|||||||
Reference in New Issue
Block a user