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

withDockerRegistry fails to authenticate with DockerHub

      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.`

          [JENKINS-38018] withDockerRegistry fails to authenticate with DockerHub

          Raphaël PINSON created issue -
          Raphaël PINSON made changes -
          Description Original: When using either `docker.withRegistry('', 'dockerhub')` or `withDockerRegistry(registry: [credentialsId: 'dockerhub'])`, a call to `mycont.push()` fails to authenticate with DockerHub:

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


          leads to:

          {code:logs}
          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
          {code}

          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.`
          New: When using either {{docker.withRegistry('', 'dockerhub')}} or {{withDockerRegistry(registry: [credentialsId: 'dockerhub'])}}, a call to {{mycont.push()}} fails to authenticate with DockerHub:

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


          leads to:

          {code:logs}
          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
          {code}

          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.`
          Raphaël PINSON made changes -
          Description Original: When using either {{docker.withRegistry('', 'dockerhub')}} or {{withDockerRegistry(registry: [credentialsId: 'dockerhub'])}}, a call to {{mycont.push()}} fails to authenticate with DockerHub:

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


          leads to:

          {code:logs}
          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
          {code}

          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.`
          New: When using either {{docker.withRegistry('', 'dockerhub')}} or {{withDockerRegistry(registry: [credentialsId: 'dockerhub'])}}, a call to {{mycont.push()}} fails to authenticate with DockerHub:

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


          leads to:

          {code:logs}
          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
          {code}

          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.`
          Raphaël PINSON made changes -
          Description Original: When using either {{docker.withRegistry('', 'dockerhub')}} or {{withDockerRegistry(registry: [credentialsId: 'dockerhub'])}}, a call to {{mycont.push()}} fails to authenticate with DockerHub:

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


          leads to:

          {code:logs}
          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
          {code}

          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.`
          New: When using either {{docker.withRegistry('', 'dockerhub')}} or {{withDockerRegistry(registry: [credentialsId: 'dockerhub'])}}, a call to {{mycont.push()}} fails to authenticate with DockerHub:

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


          leads to:

          {code:none}
          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
          {code}

          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.`
          Raphaël PINSON made changes -
          Resolution New: Fixed [ 1 ]
          Status Original: Open [ 1 ] New: Resolved [ 5 ]
          Raphaël PINSON made changes -
          Resolution Original: Fixed [ 1 ]
          Status Original: Resolved [ 5 ] New: Reopened [ 4 ]
          Jesse Glick made changes -
          Component/s New: docker-commons-plugin [ 20628 ]
          Jesse Glick made changes -
          Status Original: Reopened [ 4 ] New: Open [ 1 ]
          Jesse Glick made changes -
          Status Original: Open [ 1 ] New: In Progress [ 3 ]
          Jesse Glick made changes -
          Remote Link New: This issue links to "docker-workflow PR 71 (Web Link)" [ 14910 ]
          Jesse Glick made changes -
          Link New: This issue relates to JENKINS-28702 [ JENKINS-28702 ]

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

              Created:
              Updated:
              Resolved: