我正在尝试运行Jenkins管道脚本,它将登录到Docker并发布我的容器。
更新管道
node {
echo 'Scm Checkout'
stage('Scm Checkout'){
git credentialsId: 'githib', url: 'https://github.com/subhendugn/spring-boot-docker.git', branch: 'master'
}
stage('Mvn Package'){
def mvnHome = tool name: 'Maven3', type: 'maven'
def mvnCMD = "${mvnHome}/bin/mvn"
sh label: '', script: "${mvnCMD} clean package"
}
stage('Build Docker Image'){
sh 'docker build -t subhendugn/spring-boot-docker:latest .'
}
stage('Push Docker Image'){
withCredentials([string(credentialsId: 'docker', variable: 'test_docker')]) {
sh "docker login -u subhendugn -p ${test_docker} -e subhenduguhaneogi.93@gmail.com https://registry.hub.docker.com"
}
sh 'docker push subhendugn/spring-boot-docker:latest'
}
}但我会跟着错误走。
更新
+ docker login -u subhendugn -p **** -e test@gmail.com https://registry.hub.docker.com
WARNING: login credentials saved in /var/lib/jenkins/.dockercfg.
Login Succeeded
[Pipeline] }
[Pipeline] // withCredentials
[Pipeline] sh
+ docker push subhendugn/spring-boot-docker:latest
The push refers to a repository [subhendugn/spring-boot-docker] (len: 1)
3b9c3c5ae1a5: Buffering to Disk
3b9c3c5ae1a5: Image push failed
Please login prior to push:
Username: EOF
[Pipeline] }
[Pipeline] // stage
[Pipeline] }
[Pipeline] // node
[Pipeline] End of Pipeline
ERROR: script returned exit code 1
Finished: FAILURE有人能帮我吗?我要找的是自愿的。
谢谢
发布于 2020-02-27 12:33:17
http错误来自这一行,
码头登录-u -p ' test‘-e test@gmail.com https://hub.docker.com
您正在使用错误的注册表url尝试:
如果您使用https://registry.hub.docker.com (这是另一种选择),则需要将您的图像保留为:
docker tag .../... registry.hub.docker.com/.../...然后推
docker push registry.hub.docker.com/.../...我的意思是,它现在将不被认为是默认的,它是如何https://index.docker.io/v1/。
因此,我建议将服务器保留为空白(隐式),而不保留。
https://stackoverflow.com/questions/60431820
复制相似问题