Uploaded image for project: 'Jenkins'
  1. Jenkins
  2. JENKINS-38018

withDockerRegistry fails to authenticate with DockerHub

XMLWordPrintable

      When using either docker.withRegistry('', 'dockerhub') or withDockerRegistry(registry: [credentialsId: 'dockerhub']), a call to mycont.push() fails to authenticate with DockerHub:

        withDockerRegistry(registry: [credentialsId: 'dockerhub']) {
          cont.push()
          cont.push('latest')
        }
      

      leads to:

      Proceeding
      [Pipeline] withDockerRegistry
      [Pipeline] {
      [Pipeline] sh
      [test] Running shell script
      + docker tag --force=true camptocamp/jenkins-test camptocamp/jenkins-test:latest
      unknown flag: --force
      See 'docker tag --help'.
      + docker tag camptocamp/jenkins-test camptocamp/jenkins-test:latest
      [Pipeline] sh
      [test] Running shell script
      + docker push camptocamp/jenkins-test:latest
      The push refers to a repository [docker.io/camptocamp/jenkins-test]
      749689370cd8: Preparing
      unauthorized: authentication required
      [Pipeline] }
      [Pipeline] // withDockerRegistry
      [Pipeline] }
      [Pipeline] // node
      [Pipeline] End of Pipeline
      

      I have the credentials set up properly in Jenkins, as shown in the attached screenshot, but Jenkins Credentials Manager says `This credential has not been recorded as used anywhere.`

            jglick Jesse Glick
            raphink Raphaël PINSON
            Votes:
            16 Vote for this issue
            Watchers:
            35 Start watching this issue

              Created:
              Updated:
              Resolved: