【问题标题】:Installing homebrew in Dockerfile - mac在 Dockerfile 中安装自制软件 - mac
【发布时间】:2021-10-22 09:51:01
【问题描述】:

当我尝试在我的 Dockerfile 中安装我的依赖项时,我收到了错误:

unable to execute 'gcc': No such file or directory
#7 14.90     error: command 'gcc' failed with exit status 1

这似乎意味着我需要先在我的 Dockerfile 中安装 gcc,但由于我在 Mac 上,这意味着我还需要安装 brew。这两天找了半天也没搞明白,大家多多指教!

这是我的 docker 文件

FROM python:3
FROM condaforge/mambaforge:4.9.2-5 as conda

COPY requirments.txt .

RUN brew install gcc

RUN pip3 install -r requirments.txt

RUN conda install scikit-learn

EXPOSE 8000

CMD ["python3", "./src/copia_document_ingestion/dashboard.py"]

我使用 conda 安装 scikit-learn 的原因是因为我使用的是 m1 版本的 mac mini

【问题讨论】:

  • 你在 Mac 上的东西与你的 Dockerfile 无关。您的 Docker 映像就像完全不同的环境和操作系统。基于您的父 Docker 映像。在condaforge/mambaforge 的情况下 - 这些图像很可能基于 Ubuntu - 所以你必须像 apt-get update && apt install -y build-essential 一样安装 gcc

标签: python docker deployment dockerfile


【解决方案1】:

正如 czende 所说:

你在 Mac 上的东西与你的 Dockerfile 无关。您的 Docker 映像就像完全不同的环境和操作系统。基于您的父 Docker 映像。在 condaforge/mambaforge 的情况下——这些图像很可能基于 Ubuntu——所以你必须安装 gcc,比如 apt-get update && apt install -y build-essential

这解决了我的问题,真不敢相信我浪费了 2 天这么愚蠢。谢谢!

【讨论】:

    猜你喜欢
    • 2013-10-14
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2021-05-05
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多