使用下面的声明性管道代码,我试图从 jenkins 的 dockerhub 中提取公共图像,但是它失败并出现以下错误。
pipeline {
agent {
docker {
image 'ubuntu:latest'
label "jenkins-slave-01"
}
}
stages {
stage('Build') {
steps {
sh 'cat /etc/lsb-release'
}
}
stage('Deploy') {
steps {
sh 'cat /etc/lsb-release'
}
}
}
}
詹金斯控制台输出: -
[Pipeline] withDockerRegistry
Using the existing docker config file.Removing blacklisted property: auths$ docker login -u test -p ******** https://index.docker.io/v1/
WARNING! Using --password via the CLI is insecure. Use --password-stdin.
Error response from daemon: Get https://registry-1.docker.io/v2/: unauthorized: incorrect username or password
[Pipeline] // withDockerRegistry
[Pipeline] }
[Pipeline] // withEnv
[Pipeline] }
[Pipeline] // node
[Pipeline] End of Pipeline
ERROR: docker login failed
Finished: FAILURE
即使从 dockerhub 中提取公共图像也需要在 jenkins 中进行身份验证?由于我已经在 jenkins 中配置了私有注册表(nexus)Declarative Pipeline (Docker),因此我想从 dockerhub 中提取公共图像。
