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

Pushing images from within withRegistry block sets tag without port number

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Fixed
    • Icon: Major Major
    • docker-workflow-plugin
    • None
    • Jenkins: 2.3

      Plugins:
      - docker-workflow: 1.4

      Below pipeline DSL sets wrong tag when pushing image from within withRegistry block

      DOCKER_REGISTRY_URL = "https://dockerregistry:443"
      DOCKER_REGISTRY_CREDENTIALS = 'myuser'
      
      node('docker') {
          stage 'checkout'
          checkout scm
      
          stage 'build'
          echo "${DOCKER_REGISTRY_URL}, ${DOCKER_REGISTRY_CREDENTIALS}"
      
          docker.withRegistry(DOCKER_REGISTRY_URL, DOCKER_REGISTRY_CREDENTIALS)
          {
              def img = docker.build('myuser/img-deps:14.04', '14.04')
              img.push()
          }
      }
      

      As the result I'm getting an error message:

      docker tag --force=true myuser/img-deps:14.04 dockerregistry/myuser/img-deps:14.04
      Warning: '--force' is deprecated, it will be removed soon. See usage.
      [Pipeline] sh
      [master] Running shell script
      + docker push dockerregistry/myuser/img-deps:14.04
      The push refers to a repository [docker.io/dockerregistry/myuser/img-deps]
      c3644055bd1d: Preparing
      ...
      81a9ec52d927: Preparing
      unauthorized: authentication required
      [Pipeline] }
      [Pipeline] // withDockerRegistry
      ...
      [Pipeline] // node
      [Pipeline] End of Pipeline
      ERROR: script returned exit code 1
      Finished: FAILURE
      

      It looks like the tag which is set by push method is missing proper port number.

            Unassigned Unassigned
            luka5z Lukasz Zachulski
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated:
              Resolved: