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

docker Image.push doesn't work using withRegistry

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Duplicate
    • Icon: Minor Minor
    • docker-workflow-plugin
    • None
    • Jenkins version: 2.40

      Jenkinsfile contains the following section:

      node ('Docker') {
              stage('Checkout') {
                      checkout scm
              }
              withDockerRegistry([credentialsId: 'XXXXX', url: 'http://registry.domain.com:5000']) {
                      stage('Build Docker Image') {
      
                              def DockerApp = docker.build "registry.domain.com:5000/user/imagename"
      
                              DockerApp.push 'JenkinsTest'
      
                      }
              }
      }
      

      But the image is named incorrectly when tagged during the DockerApp.Push.

      Pipeline Output:

      [snip]
      Successfully built 0f9f005fdb18
      [Pipeline] dockerFingerprintFrom
      [Pipeline] sh
      [Github_statsite_Jenkinstest-EGEMJERB5XG2N2GF64UBC26O6ZDZ5DONMPY6CGFCYDTZ33PBX4GA] Running shell script
      + docker tag --force=true registry.domain.com:5000/user/imagename registry.domain.com:JenkinsTest
      unknown flag: --force
      See 'docker tag --help'.
      + docker tag registry.domain.com:5000/user/imagename registry.domain.com:JenkinsTest
      [snip]
      

      It seems to be truncated at the : for the port number, and then tries uploading the image as docker.io/library/registry.domain.com

            Unassigned Unassigned
            jasonrivers Jason Rivers
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated:
              Resolved: