PIP在Docker映像中安装私有GCP Repos

时间:2018-08-21 12:33:31

标签: git docker pip google-cloud-platform gcloud

我正在尝试从我的私有GCP存储库上的Docker映像安装自定义python软件包。直接在Compute Instance上安装时,以下程序可以正常工作:

git config --global credential.helper gcloud.sh
sudo pip install git+https://source.developers.google.com...(my repo & 
branch)

这允许我导入我的包并在主python脚本中使用它。 但是,当我尝试使用类似方法创建docker映像时:

Docker文件:

FROM python:2
RUN git config --global credential.helper gcloud.sh
RUN pip install git+https://source.developers.google.com/p/....

Docker创建命令:

docker build -t myimagename .

我得到:

git: 'credential-gcloud.sh' is not a git command. See 'git --help'.
fatal: could not read Username for 
'https://source.developers.google.com': No such device or address
Command "git clone -q https://source.developers.google.com/p/..." 
failed with error code 128 in None
The command '/bin/sh -c pip install 
git+https://source.developers.google.com/p/...' returned a non-zero 
code: 1

我该如何提供必要的凭据,同时牢记此docker需要以安全的方式在Compute Engine上运行?

0 个答案:

没有答案