gpt4 book ai didi

docker - 在构建 Docker 镜像时使用来自私有(private) gitlab 存储库的 pip install

转载 作者:行者123 更新时间:2023-12-04 19:24:30 29 4
gpt4 key购买 nike

我正在尝试在 Ubuntu 机器上构建一个 docker 镜像,其中一个依赖项是
一个内部托管的 Gitlab 项目(它不在 GITLAB.COM 上托管)。
docker 文件是:

FROM  rayproject/ray:1.12.0-py39-cpu
RUN git config --global user.name <MY USER NAME>
RUN git config --global http.sslVerify false
COPY .ssh/id_rsa /home/ray/.ssh/id_rsa
RUN sudo chmod -R 777 ~/.ssh/*
RUN eval "$(ssh-agent -s)"
RUN eval `ssh-agent -s` && ssh-add $HOME/.ssh/id_rsa
RUN pip install git+https://gitlab.<EMPLOYERS DOMAIN>.com/xyz/my_project.git
我正在尝试使用以下命令构建 docker 文件:
docker build .
构建 docker 镜像时收到此错误消息:
Step 8/29 : RUN pip install git+https://gitlab.<EMPLOYERS DOMAIN>.com/xyz/my_project.git
---> Running in b9e11319c84d
Collecting git+https://gitlab.<EMPLOYERS DOMAIN>.com/xyz/my_project.git
Cloning https://gitlab.<EMPLOYERS DOMAIN>.com/xyz/my_project.git to /tmp/pip-req-build-l1qklujg
Running command git clone -q https://gitlab.<EMPLOYERS DOMAIN>.com/xyz/my_project.git /tmp/pip-req-build-l1qklujg
fatal: could not read Username for 'https://gitlab.<EMPLOYERS DOMAIN>.com': No such device or address
WARNING: Discarding git+https://gitlab.<EMPLOYERS DOMAIN>.com/xyz/my_project.git. Command errored out with exit status 128: git clone -q https://gitlab.<EMPLOYERS DOMAIN>.com/xyz/my_project.git /tmp/pip-req-build-l1qklujg Check the logs for full command output.
ERROR: Command errored out with exit status 128: git clone -q https://gitlab.<EMPLOYERS DOMAIN>.com/xyz/my_project.git /tmp/pip-req-build-l1qklujg Check the logs for full command output.
但是,从我的机器上,我可以运行
pip install https://gitlab.<EMPLOYERS DOMAIN>.com/xyz/my_project.git
无需输入我的用户名/密码。
我不确定我的机器是否配置为使用 RSA key 登录内部 Gitlab。
构建 docker 镜像时如何安装包?

最佳答案

使用ssh而不是 https . IE。

RUN pip install git+ssh://gitlab.<EMPLOYERS DOMAIN>.com/xyz/my_project.git

关于docker - 在构建 Docker 镜像时使用来自私有(private) gitlab 存储库的 pip install,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/72440280/

29 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com