Reputation: 33
I'm doing a declarative pipeline with several stages. And in one of the stages i want to deploy a war file on a running docker with the tomcat image. For this i use the command curl. But i always get the following error on jenkins:
% 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 15.7M 0 0 0 0 0 0 --:--:-- --:--:-- --:--:-- 0
curl: (52) Empty reply from server
Here is my code:
pipeline {
agent any
....
stage ('System test') {
steps{
bat 'docker run -d -p 9205:8080 tomcat:7.0.82'
dir('some/dir/something'){
script{
bat 'curl -T "C:/path/to/solution.war" "http://tomcat:tomcat@localhost:9205/manager/text/deploy?path=/solution.war&update=true"'
}
input 'Do you want to proceed?'
}
}
}
Things i already tried:
curl -L
netstat -a -p TCP -n | grep 3000 (port used) .. To see if there are no more multiple connections
Curl with Credentials
Upvotes: 0
Views: 1152
Reputation: 753
looks like tomcat is only listening on 127.0.0.1 (localhost) inside container whereas it should be listening on 0.0.0.0.
Have you tried to curl inside the container using the following command
docker exec -it <container_name> curl 'curl -T "C:/path/to/solution.war" "http://tomcat:tomcat@localhost:8080/manager/text/deploy?path=/solution.war&update=true"'
if this works then you have to configure Tomcat to listen on all IP
tomcat/conf/server.xml
.<Connector port="8080" protocol="HTTP/1.1" address="0.0.0.0" connectionTimeout="20000" redirectPort="8443" />
Hope this helps.
Upvotes: 0