Docker Push in Jenkins-拒绝:请求的资源访问被拒绝

0kjbasz6  于 2022-10-06  发布在  Docker
关注(0)|答案(1)|浏览(197)

因此,我正试图在Jenkins建立一条渠道,建立形象,并将他们推向Docker Hub。我在Manage‘Jenkins’中的凭据被称为与“docker-Hub-Credentials”相同的凭据,似乎正在使用。

它可以建造,但它只是不能通过推送...帮助?我已经等了好几个小时了,我不确定我错过了什么。

我已经试过使用码头登录,但Jenkins不允许。

  1. stage('Build image') {
  2. /* This builds the actual image; synonymous to
  3. * docker build on the command line */
  4. bat 'docker build -t username/foldername:build . ' }
  5. stage('Push image') {
  6. /* Finally, we'll push the image with two tags:
  7. docker.withRegistry('https://registry.hub.docker.com', 'docker-hub-credentials') {
  8. bat 'docker push username/foldername:build'
  9. }
  10. }

我希望这个形象会被推送,但我有这样的想法:

  1. The push refers to repository [docker.io/username/foldername]
  2. a73d7d9f4346: Preparing
  3. 964bdfb24a54: Preparing
  4. 1af124d739c9: Preparing
  5. 6cffeea81e5d: Preparing
  6. 614a79865f6d: Preparing
  7. 612d27bb923f: Preparing
  8. ef68f6734aa4: Preparing
  9. 612d27bb923f: Waiting
  10. ef68f6734aa4: Waiting
  11. denied: requested access to the resource is denied
8hhllhi2

8hhllhi21#

我找到答案了!

  1. stage('Push image') {
  2. withDockerRegistry([ credentialsId: "docker-hub-credentials", url: "" ]) {
  3. bat "docker push devopsglobalmedia/teamcitydocker:build"
  4. }

相关问题