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

CentOS下Docker构建报错/bin/sh: url: command not found怎么解决

核心问题

CentOS 官方软件源不存在名为 url 的软件包,你遇到报错的根本原因是 Dockerfile 中的下载命令书写错误,Linux 下常用的命令行下载工具为 curl 和 wget,没有默认提供名为 url 的下载命令。

修复方案

你可以任选以下任意一种方案修改 Dockerfile 即可解决报错:

方案1:使用 curl 作为下载工具

  • 在 yum 安装列表中添加 curl 依赖
  • 将原命令中的 url -O 替换为 curl -O
    修改后的完整 RUN 指令如下:
RUN yum install python3 curl -y\
    && curl -O https://bootstrap.pypa.io/get-pip.py \
    && python3 get-pip.py\
        #no --user - install for the whole machine
    && pip install awscli --upgrade

方案2:使用 wget 作为下载工具

  • 在 yum 安装列表中添加 wget 依赖
  • 将原命令中的 url -O 替换为 wget(wget 默认会保留远程文件原名,无需额外加 -O 参数,加也可正常运行)
    修改后的完整 RUN 指令如下:
RUN yum install python3 wget -y\
    && wget https://bootstrap.pypa.io/get-pip.py \
    && python3 get-pip.py\
        #no --user - install for the whole machine
    && pip install awscli --upgrade

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

相关产品推荐
方舟 Agent Plan

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

最近更新时间:2026.10.03 06:06:03