How to start Docker Jenkins container in windows 10.
Precondition- Docker should be installed .
To pull Jenkins image
docker pull jenkins
Then open a command line or GITBASH window by right click and run as administrator.
docker run -u 0 — name MyJenkins -p 8080:8080 -p 50000:50000 -v /Users/username/Desktop/Jenkins_Home:/var/jenkins_home jenkins
Jenkins_Home will be created and it will be similar and corresponding to jenkins_home folder.
The last jenkins is the image name which we downloaded form docker.
To solve an error I used the -u parameter. Keep in mind this will run as a root user (uid=0)
If you get an error it is more likely due to below issue in docker itself.
A bug is there .
https://github.com/docker/for-win/issues/3171
docker: Error response from daemon: Ports are not available: listen tcp 0.0.0.0:50000: bind: An attempt was made to access a socket in a way forbidden by its access permissions.
solution is type below command in cmd and reboot
reg add HKLM\SYSTEM\CurrentControlSet\Services\hns\State /v EnableExcludedPortRange /d 0 /f
Then re run the command to create Jenkins.
This may also be found at: /var/jenkins_home/secrets/initialAdminPassword*************************************************************
Password can be found in the above section in the log.
Jenkin URL to access the site is given below and create an account using the password.
http://localhost:8080/loginError