【发布时间】: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