What I am trying to do: Create a Windows Slave from a Linux (Ubuntu) Master on Jenkins.
Jenkins is inside a container (Docker).
I followed the step-by-step here: https://scmquest.com/jenkins-windows-slave-configuration-with-screenshots/
And when I tried to launch the agent, I have an error like this: enter image description here
Okay I find out how.
I did docker container ls then under PORT there's x.x.x.x:8080->8080/tcp, x.x.x.x:50000->50000/tcp. I set the port to 500000 in Jenkins->Configure Global Security->Agent.
Now I have another error from java.
java.lang.NoClassDefFoundError:java/sql/Date
Related
I need help in creating the container through Jenkins job.
Let me know the steps to be followed: I have already created 3 jobs in Jenkins, and I want to create httpd container through the jobs created.
Should I install any plugins or write any script ?
Assuling we are not talking about Jenkins in docker, or Jenkins agents in Docker, you need to create your http container manually first, without Jenkins.
That means:
validate your SSH access to the remote server
Check it has Docker installed
execute docker commands to run an http container, s described in Docker httpd
Once that is working, you can replicate the process in a Jenkins Job, provided your remote server (the one with Docker, where you want to run your httpd container) is declared as agent to the main Jenkins controller.
I just pulled the Jenkins image from docker hub by using below command.
sudo docker pull jenkins
sudo docker run -p 7071:7071 -p 50000:50000 jenkins this command help me to run the jenkins image inside the docker container
Now the problem is that I just want to run the Jenkins console to create a some sample test jobs. When I tried to access this from some windows machine I'm not able to connect and It returned 404 error code.
Tried to connect the Jenkins from Windows machine.
http://<ip address>:7071 -> this is failing to connect.
http://<ip address>:50000 -> This returning the Jenkins Agent Protocol details
Output:
Jenkins-Agent-Protocols: JNLP-connect, JNLP2-connect, JNLP4-connect,
Ping Jenkins-Version: 2.60.3 Jenkins-Session: cba34bd8 Client:
XXXXXXXX Server: YYYYYYYY
Can someone help me since I'm new to docker + jenkins world and want to know how to connect the dockerized jenkins that is hosted in the Linux box.
Thanks in advance.
The main port used by Jenkins for access via the web console is 8080 and so add:
docker run ... -p 8080:8080
Below are the steps I followed:
Access Linux server using putty from Windows 7
Run docker run -d -P -p 4545:4444 --name standalone_grid selenium/standalone-chrome on Linux
Launch chrome browser on windows and try to access
http://<linux_server_ip>:4545. Error site can't be reached. This server also has Jenkins installed which can be accessed at http://<linux_server_ip>:8080
How can I fix this? Am I doing anything wrong?
docker ps out put
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
60422c2cd9b1 selenium/standalone-chrome "/opt/bin/entry_poin…" About an hour ago Up About an hour 0.0.0.0:4545->4444/tcp standalone_grid
As mentioned in the comments first thing you want to check if the container is up:
docker ps
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
b7a560331584 selenium/standalone-chrome "/opt/bin/entry_poin…" 2 minutes ago Up 2 minutes 0.0.0.0:4545->4444/tcp standalone_grid
Next step would be just to verify locally is it working from the Linux console:
curl http://<linux_server_ip>:4545
If this works you already know it is a networking issue. Please check your local iptables rules:
sudo iptables -L INPUT
to see if there are any restrictions for incoming connections. If this is empty the the issue lays in connectivity within the network itself. You can try to workaround it by using a Putty ssh tunnel.
EDIT:
The issue was related to port 4545, using a different port resolved the problem.
I am trying to use the Docker Remote API on a Windows 10 host machine. I am using Chrome's Postman extension to see if I can get results from the docker remote api's endpoints. Here are the endpoints that I've tried:
GET http://192.168.99.100:4243/images/json
GET http://192.168.99.100:2376/images/json
Both returned Connection to server 192.168.99.100 failed (The server is not responding)
After a few searches I found out that the Docker Remote API is not enabled by default on Windows. Most of the guides are for Ubuntu but I have found this particular one for Windows.
These are the steps that I performed on my machine
docker-machine ssh
cd /var/lib/boot2docker
sudo vi profile
Change DOCKER_HOST='H tcp://0.0.0.2376' to DOCKER_HOST='H tcp://0.0.0.2375'
change DOCKER_TLS=auto to DOCKER_TLS=no
export DOCKER_HOST='-H tcp://0.0.0.2375'
export DOCKER_TLS_VERIFY=0
env | grep DOCKER
docker-machine restart
docker-machine env
docker-machine regenerate-certs
After performing the steps above, I did try again the endpoints on Postman but I still get the same result.
Can you perhaps give a little help if I have missed a step? Or am I on track?
Also, to answer some of my queries.
Is the docker remote api port for Windows 2375 and 4243 for Linux?
Is DOCKER_HOST for Windows and DOCKER_OPTS for Linux?
Switch your docker to windows container
Got to C:\ProgramData\Docker\config
in deamon.json file
add "hosts": ["tcp://0.0.0.0:2376", "npipe://"]
restart docker.
give command : docker -H tcp://0.0.0.0:2376 ps
The Remote API is now enabled by default on Windows (see ticket here).
It is reachable at http:\\localhost:2375 indeed (tested it).
I faced the same issue and found a quick solution for this. Just open docker settings and enable "Expose daemon on TCP..." checkbox. Docker will start automatically and the problem should be solved.Please find the image attached for reference
using docker desktop, go to settings and check "Expose daemon on tcp://localhost:2375 without TLS"
I have installed Jenkins on Linux server. I am using 9091 port to run Jenkins & installed SSL to that. Jenkins URL looks like following one (https://testurl.com:9091/)
When I am trying to open Jenkins it's not get opened. Jenkins log file is given below.
How to recover Jenkins & open it..?