You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

如何以编程方式获取Miniconda安装包的SHA256哈希值?

Miniconda Containerfile自动SHA256校验方案

不用解析文档页面,Anaconda官方为每个Miniconda安装包提供了对应的SHA256哈希文件,直接从下载服务器获取即可实现自动校验,无需硬编码哈希值。

优化后的Containerfile命令

将下载、校验、安装、清理合并为一个RUN指令(减少镜像层数):

RUN wget --https-only https://repo.anaconda.com/miniconda/Miniconda3-latest-Linux-x86_64.sh \
    && wget --https-only https://repo.anaconda.com/miniconda/Miniconda3-latest-Linux-x86_64.sh.sha256 \
    && sha256sum --check Miniconda3-latest-Linux-x86_64.sh.sha256 \
    && bash Miniconda3-latest-Linux-x86_64.sh -b \
    && rm -f Miniconda3-latest-Linux-x86_64.sh Miniconda3-latest-Linux-x86_64.sh.sha256

关键说明

  • --https-only强制使用HTTPS下载,避免明文传输的安全风险
  • sha256sum --check会自动比对安装包和哈希文件的校验值,不匹配时直接终止镜像构建,确保安装包完整性
  • 最后删除安装脚本和哈希文件,减少镜像体积

内容的提问来源于stack exchange,提问作者Zorglub29

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.06.17 04:45:55