Installing jenkins with Docker

0 votes
How do I install Jenkins using Docker? Do I need to write a Dockerfile?
Apr 15 in Docker by Jinu
48 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 15 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 by Sirajul
• 25,700 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
• 6,890 points
44 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,510 points

edited Oct 15, 2018 by Kalgi 266 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
654 views
0 votes
1 answer
0 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
• 56,520 points
156 views
0 votes
1 answer

Error while installing Docker for windows 10

Docker for windows is compatible with only ...READ MORE

answered Oct 26, 2018 in Docker by Tyrion anex
• 8,270 points
102 views
0 votes
1 answer