Home > Back-end >  Jfrog artifactory intigration with jenkins
Jfrog artifactory intigration with jenkins

Time:09-05

I created a local docker repository on jfrog artifactory now, I want to push the docker image using jenkins pipeline. can some one guide me and provide some resource link as well

Thanks

CodePudding user response:

Given Artifactory acts as any other docker registry, you can simply use the Docker step in a Pipeline and do something like the below.

docker.withRegistry('https://artifactoryu.registryy', 'credentials-id') {

        def customImage = docker.build("my-image:${env.BUILD_ID}")

        /* Push the container to the custom Registry */
        customImage.push()
    }

Else you can simply use a shell script to do this.

sh'''
docker login ${server-name}.jfrog.io
docker tag <image name> ${server-name}.jfrog.io/{repo-name}/<image name>
docker push ${server-name}.jfrog.io/{repo-name}/<image name>
'''

CodePudding user response:

You can find the complete snippet here https://github.com/jfrog/project-examples/blob/master/jenkins-examples/pipeline-examples/declarative-examples/docker-push-example/Jenkinsfile

ARTIFACTORY_DOCKER_REGISTRY should be IP/Artifactory-Repo-Key/IMAGE:TAG

HOST should be docker daemon.

  • Related