Installing jenkins with Docker

0 votes
How do I install Jenkins using Docker? Do I need to write a Dockerfile?
Apr 16, 2019 in Docker by Jinu
967 views

2 answers to this question.

0 votes

You don't really need to have a Dockerfile for this purpose. use the following command to pull Jenkins image

docker pull Jenkins

Run the image

docker run -d -p 49001:8080 -v $PWD/jenkins:/var/jenkins_home:z -t jenkins
answered Apr 16, 2019 by Pallavi
0 votes
  • You should have docker properly installed on your machine. 
  • First, pull the official jenkins image from Docker repository.
docker pull jenkins
  • Next, run a container using this image and map data directory from the container to the host; 

In the example below /var/jenkins_home from the container is mapped to jenkins/ directory from the current path on the host. Jenkins 8080 port is also exposed to the host as 49001.

docker run -d -p 49001:8080 -v $PWD/jenkins:/var/jenkins_home:z -t jenkins/jenkins

Addtionally, you can configure nginx as a reverse proxy to your Jenkins instance, e.g:

upstream app {
    server 127.0.0.1:49001;
}
server {
    listen 80;
    server_name jenkins.your-domain.com;
    location / {
        proxy_pass http://app;
    }
}
answered Aug 5, 2019 by Sirajul
• 59,230 points

Related Questions In Docker

0 votes
1 answer

build an J2EE application with docker

I would suggest you to use volume ...READ MORE

answered May 1, 2018 in Docker by shubham
• 7,340 points
944 views
0 votes
1 answer

Docker ports are working on the localhost but not with public ip

Probably, the reason is that you've included ...READ MORE

answered Jun 12, 2018 in Docker by Damon Salvatore
• 5,980 points

edited Oct 15, 2018 by Kalgi 4,204 views
0 votes
1 answer

Docker containers as Jenkins Slave build agents

When you encapsulate the stage inside a ...READ MORE

answered Jun 16, 2018 in Docker by Atul
• 10,240 points
2,455 views
+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,739 views
0 votes
2 answers

Error while installing Docker for windows 10

RUN cmd as administrator then check use ...READ MORE

answered Aug 26, 2020 in Docker by Pistle
• 1,000 points
2,839 views
0 votes
1 answer
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