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

Declarative Pipeline push into docker registry

      From (-JENKINS-39684- and -JENKINS-40524-) we can now use the agent to pull from other registries with credentials:
      agent {
        dockerfile {
          registryUrl 'https://myregistry.com/'    registryCredentialsId 'myPredefinedCredentialsInJenkins'
        }
      }
      But what is the mechanism to push into a registry upon successful build/test/etc?

       

          [JENKINS-45347] Declarative Pipeline push into docker registry

          Andrew Bayer added a comment -

          You're combining two use cases, I'd say - building an image for deployment purposes and building an image in order to run a stage inside it. If you want to do both, I'd suggest building the image in an earlier stage via sh "docker build..." or similar, then in the stage where you want to run in it, just use the docker agent type with the image tag, and finally do a sh "docker push ..." to push.

          Andrew Bayer added a comment - You're combining two use cases, I'd say - building an image for deployment purposes and building an image in order to run a stage inside it. If you want to do both, I'd suggest building the image in an earlier stage via sh "docker build..." or similar, then in the stage where you want to run in it, just use the docker agent type with the image tag, and finally do a sh "docker push ..." to push.

          Liam Newman added a comment -

          Bulk closing resolved issues.

          Liam Newman added a comment - Bulk closing resolved issues.

            abayer Andrew Bayer
            jraub_switch Jordan Raub
            Votes:
            3 Vote for this issue
            Watchers:
            4 Start watching this issue

              Created:
              Updated:
              Resolved: