Ale*_*lls 2 jenkins docker docker-login
我有这个:
docker login -u AWS --password-stdin https://aws_account_id.dkr.ecr.us-east-1.amazonaws.com
Error: Cannot perform an interactive login from a non TTY device
Build step 'Execute shell' marked build as failure
Run Code Online (Sandbox Code Playgroud)
我们如何在 Jenkins 服务器上运行 docker login (或等效的)?
我能够通过使用来解决这个问题:
eval "$(aws ecr get-login --no-include-email --region ${region} --profile ${profile})"
Run Code Online (Sandbox Code Playgroud)
但是在我尝试运行后出现此错误docker push:
没有基本的身份验证凭据
正如@matt-schuchard 提到的,您可以使用Docker Pipeline Plugin。就我而言,我使用了docker.withRegistry([...]). 在下面找到一个完整的例子:
node {
def app
stage('Clone repository') {
/* Clone your repo */
}
stage('Build image') {
/* Build your image */
app = docker.build("<image name>")
}
stage('Push image') {
/* Push image using withRegistry. */
docker.withRegistry('<your docker registry>', 'docker-private-credentials') {
app.push("${env.BUILD_NUMBER}")
app.push("latest")
}
}
}
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
9216 次 |
| 最近记录: |