作者:啊沙发的非飞 | 来源:互联网 | 2023-01-21 14:26
我有一个dockerfile.我必须使用https url从bitbucket克隆存储库,但我想如何传递密码以使克隆完成? 是的,我尝试了ssh.它工作,但我需要https克隆的一些shell脚本运行,以便它应自动接受密码.
这是我的docker命令克隆repo:
运行git clone https://username@bitbucket.org/abc/xyz.git
这是我在buildind docker文件中得到的错误:\
克隆到'newfolder'...致命:无法读取' https://username@bitbucket.org '的密码:没有这样的设备或地址
我的构建命令是:
sudo docker build --no-cache = true -t image:build.
1> yamenk..:
您可以在URL中指定密码:
git clone https://username:password@bitbucket.org/abc/xyz.git
如果您不想在dockerfile中对密码进行硬编码,则可以将其作为构建arg传递.
ARG password
RUN git clone https://username:$password@bitbucket.org/abc/xyz.git
sudo docker build --build-arg password=pass --no-cache=true -t image:build .