【问题标题】:Install python library from a git repo in docker从 docker 中的 git repo 安装 python 库
【发布时间】:2021-02-04 01:38:32
【问题描述】:

在我的本地机器上,我正在使用以下命令从 git repo 安装一个非官方的 python 包(未发布)

python -m pip install "mod1 @ git+https://github.com/....git"

如何在 docker 文件中安装库?

【问题讨论】:

  • 只需运行与 Dockerfile 的一部分相同的命令?

标签: python docker dockerfile


【解决方案1】:

如果 docker 容器正在运行,而您没有在容器内交互运行,则可以使用 exec 命令:

docker exec -it <container_id_or_name> python -m pip install "mod1 @ git+https://github.com/....git"

如果你在一个容器中,你应该能够按原样使用命令,假设你已经在容器中安装了python(即找不到命令'python')。

从 dockerfile depending on your needs,您可以使用 RUN command

【讨论】:

    猜你喜欢
    • 2020-04-17
    • 2013-12-04
    • 2020-04-25
    • 2022-01-16
    • 1970-01-01
    • 2016-07-09
    相关资源
    最近更新 更多