【问题标题】:Jenkins curl: (52) Empty reply from serverJenkins curl:(52)来自服务器的空回复
【发布时间】:2017-12-05 22:05:27
【问题描述】:

我正在做一个包含多个阶段的声明性管道。在其中一个阶段,我想在正在运行的 docker 上部署一个带有 tomcat 映像的 war 文件。为此,我使用命令 curl。但我总是在詹金斯上得到以下错误:

  % 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

这是我的代码:

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?'
                }
            }
        }

我已经尝试过的事情:

  • 卷曲-L

  • netstat -a -p TCP -n | grep 3000(使用的端口)..查看是否没有更多的多个连接

  • Curl with Credentials

【问题讨论】:

    标签: tomcat docker curl jenkins


    【解决方案1】:

    看起来 tomcat 只在容器内的 127.0.0.1 (localhost) 上侦听,而它应该在 0.0.0.0 上侦听。

    您是否尝试过使用以下命令在容器内卷曲

    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"'
    

    如果这可行,那么您必须将 Tomcat 配置为侦听所有 IP

    1. 编辑tomcat/conf/server.xml
    2. 为该连接器指定一个绑定地址:
      
      

    希望这会有所帮助。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2015-11-05
      • 1970-01-01
      • 1970-01-01
      • 2021-05-07
      • 2015-05-05
      • 2010-12-27
      • 1970-01-01
      • 2021-08-03
      相关资源
      最近更新 更多