如何将凭证添加到Docker ADD命令 [英] How to add credentials to Docker ADD command

查看:89
本文介绍了如何将凭证添加到Docker ADD命令的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有这个:

ADD https://bitbucket.org/teros/vana/raw/"$commit"/mw/requirements.txt  'requirements.txt'






但由于我需要凭据,因此HTTP请求无法正常工作。我确实知道此curl命令有效:


but the HTTP request won't work since I need creds. I do know that this curl command works:

bitbucket_curl(){
   curl -H 'Authorization:Basic YW1bGx..plM2JyKg==' "https://api.bitbucket.org$@"
}



< hr>

(令牌已修改,但命令正确)


(token was modified, but the command is o/w right)

所以也许有一个令牌可以包含在内作为Bitbucket的网址参数?

So maybe there's a token I can included as a url parameter with Bitbucket?

推荐答案

应该很简单:

ARG bitbucket_pwd
ARG commit

ADD "https://user@domain.com:$bitbucket_pwd@bitbucket.org/teros/vana/raw/$commit/mw/requirements.txt"  '/temp/requirements.txt'






您可以使用-build-arg

docker build --build-arg bitbucket_pwd="$bitbucket_password"

这篇关于如何将凭证添加到Docker ADD命令的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆