Reputation: 3
I have seemed to run into some issues with curl, I have created a freestyle Jenkins job to build and deploy a basic hello world docker image. The build and deployment work fine, but I ran a curl command to test the deployment and it always fails the job
below is the script that I ran
npm install
docker build -t rvarg11/helloworld2 .
docker rm -f dockertest
docker run -d -p 3000:3000 --name dockertest rvarg11/helloworld2
curl -f http://127.0.0.1:3000
the jobs fail with the below error when Jenkins reach the curl command
curl -f http://127.0.0.1:3000 % Total % Received % Xferd Average Speed Time Time Time Current Dload Upload Total Spent Left Speed
0 0 0 0 0 0 0 0 --:--:-- --:--:-- --:--:-- 0 0 0 0 0 0 0 0 0 --:--:-- --:--:-- --:--:-- 0 curl: (52) Empty reply from server
this is only an issue when I try curl from the same job that I used for build , if I create a separate job and try to curl it works without any issues I am new to all this and this is the first time I am posting a question hope I have explained everything properly enter image description here
Upvotes: 0
Views: 1227
Reputation: 945
Since it is working fine from another Jenkins job, it is because there is a time delay for Jenkins executor to pick up the next job by which time the application is ready to accept request causing the subsequent job to be success. An appropriate delay in the current job before making the curl request should solve the problem.
Upvotes: 1