On my very first time, I was getting issue on running jenkins on docker which is running on windows 7.
I followed below procedure to solve the issue
- To know if jenkin (all) is pulled from docker hub or not:
$ docker ps
- To know about your docker information
$ docker info
- Know the ip address of your docker
$ docker-machine ip default
- Pull jenkins from docker hum
$ docker pull jenkins
- Run jenkins on 8080 port
$ docker run -p 8080:8080 --name=jenkins-master jenkins
Copy the password for jenkins(it is required when you would hit the browser)
- Then open browser, put the address as below to access jenkins
ip Address of your jenkins(when you called $ docker-machine ip default):8080
- Now it would ask you the password which mentioned on point 5.
- Now configure plugins as per your requirement.
These are the lines to follow when you are setting jenkins on “Docker”
This is fine but not sufficient if your jenkins pipeline has docker build or run commands in it. In that case the dockerized jenkins instance needs to talk to a docker daemon.
The typical solution is to mount
/var/run/docker.sock into the jenkins container, such that jenkins inside the container will talk to the docker daemon on the host, but this comes with other challenges as described in this blog.
The blog also describes a clean solution to the problem, by placing jenkins + docker cli + docker daemon inside the container. This avoids headaches by placing jenkins in the same context as the docker daemon (i.e., both are inside a container, rather than one inside the container and the other on the host).
I recently founded Nestybox, which enables this solution without using Docker privileged containers. It has already helped others in this forum.
Hope this helps!