我正在尝试构建码头集装箱并使用jenkins对同一个构建的集装箱运行集成测试。Jenkins无法卷曲到码头集装箱上的http端点主机
我目前遇到的问题是我可以建立并运行容器,当我试图对http端点进行卷曲时,我得到一个连接拒绝。所以我相信这是我的詹金斯奴隶配置。我已经将jenkins用户添加到wheel docker jenkins
组,并且当我运行记录为jenkins的curl命令时,它可以工作。但是当我从詹金斯运行它时,我得到一个连接拒绝。
JenkinsFile
sh "docker build -t my-service ."
sh "docker rm -f my-service || true"
sh "docker run -d -p 9091:5000 -p 1433:1433 --name=my-service my-service"
sh "docker ps"
sh "curl -v http://172.16.32.20:9091/api/products/"
詹金斯输出
+ curl -v http://172.16.32.20:9091/api/products/baggingoptions
* About to connect() to 172.16.32.20 port 9091 (#0)
* Trying 172.16.32.20...
% Total % Received % Xferd Average Speed Time Time Time
Current
Dload Upload Total Spent Left Speed
0 0 0 0 0 0 0 0 --:--:-- --:--:-- --:--:--
0* Connection refused
* Failed connect to 172.16.32.20:9091; Connection refused
* Closing connection 0
curl: (7) Failed connect to 172.16.32.20:9091; Connection refused
从信息:
Static hostname: **************************
Icon name: computer-vm
Chassis: vm
Machine ID: 009cdec7fded4740be96692dfee788c0
Boot ID: fe492def29c047bf910c213911fda980
Virtualization: vmware
Operating System: CentOS Linux 7 (Core)
CPE OS Name: cpe:/o:centos:centos:7
Kernel: Linux 3.10.0-514.26.2.el7.x86_64
Architecture: x86-64
你为什么映射两个端口?您的服务在两个不同的端口(5000和1433)上运行? – JBone
我的应用程序需要这两个端口 –