How to push public docker images to an artifactory using Jenkins

948 views Asked by At

I am trying to push a public image (confluentic/cp-zookeeper) under a different name into jfrog artifactory using Jenkins, with a Jenkinsfile. I have tried in pulling the image and retagging it but it doesn't work. I currently have one step to push my own dockerfile to the artifact, so I know the pipeline works. any help would be appreciate it

1

There are 1 answers

0
0909EM On

You should be able to define a stage like...

  stage {
    steps {
      script {
        docker.withRegistry(registry, credentials) 
        {
          def dockerImage = docker.build("acme-dockerv2-virtual.jfrog.io/hello-world")

          dockerImage.push()
        }
      }
    }
  }

Where this assume registry is something like acme-dockerv2-virtual.jfrog.io, and credentials are whatever you need for artifactory...