pull and run pushed docker image

+1 vote
Hi,

I'm building a docker image using an jenkins pipeline and push it into docker registry, now i want to pull and run this image in other remote server. I am not sure this step (pull&run) must be in jenkis pipline and how.

thanks
Feb 25, 2020 in Jenkins by anonymous
• 130 points
1,056 views

1 answer to this question.

0 votes

Let's break this into 2 stages:
Stage 1 - Image generation & Upload Image
Stage 2 - Create container using newly created image

Stage 1: This can be achieved in many ways:

  • Try to write a shell/python script which would use docker native commands like 'docker build' to generate Image & 'docker push' to push to the registry

  • Try using 'docker.withRegistry' Jenkins scripted directive to create Image & push Image in one step

Stage 2:  By default when you try to create the container Docker would download the Image from the specified Docker Registry, so once you have uploaded the image in the previous stage to Registry, use any of your interested steps using docker native cmds or script or pipeline to create the container by specifying the correct Image path i.e 

<UR-DOCKER-REGISTRY>/<UR-REPO>/<UR-IMAGE>:<UR-TAG> 

and it will download the Image on the machine where u r running it, then the container will run !!

answered Feb 25, 2020 by Adam

Related Questions In Jenkins

0 votes
2 answers
0 votes
1 answer

I’m facing a login error when I try to run Jenkins on Docker. How do I solve this?

You have to open the /var/log/jenkins/jenkins.log file to ...READ MORE

answered Jul 24, 2018 in Jenkins by Sophie may
• 10,620 points
3,575 views
0 votes
5 answers
+2 votes
1 answer
+2 votes
1 answer

Deploy Docker Containers from Docker Cloud

To solve this problem, I followed advice ...READ MORE

answered Sep 3, 2018 in AWS by Priyaj
• 58,020 points
2,715 views
0 votes
1 answer

Jenkins and Docker: How can I customize my jenkins pipeline to use docker?

Jenkins Pipeline is designed to easily use ...READ MORE

answered Aug 26, 2019 in Jenkins by Sirajul
• 59,230 points
1,696 views
+4 votes
7 answers

How to set the pipeline name and description for a Jenkinsfile?

You can rename pipeline jobs in jenkins ...READ MORE

answered Oct 11, 2018 in Jenkins by Hannah
• 18,520 points
36,367 views
webinar REGISTER FOR FREE WEBINAR X
REGISTER NOW
webinar_success Thank you for registering Join Edureka Meetup community for 100+ Free Webinars each month JOIN MEETUP GROUP