我有一个带有以下容器的 docker 设置:
- 硒集线器
- 硒火狐
- 硒铬
- 春季启动应用程序
- wct 测试的 node/java 服务
所有这些容器都是通过 docker-compose 定义的。node/java 服务创建如下(从 docker-compose 中提取):
wct:
build:
context: ./app/src/main/webapp
args:
ARTIFACTORY: ${DOCKER_REGISTRY}
image: wct
container_name: wct
depends_on:
- selenium-hub
- selenium-chrome
- selenium-firefox
- webapp
wct 测试使用以下命令运行:
docker-compose run -d --name wct-run wct npm run test
wct.conf.js 如下所示:
const seleniumGridAddress = process.env.bamboo_selenium_grid_address || 'http://selenium-hub:4444/wd/hub';
const hostname = process.env.FQDN || 'wct';
module.exports = {
activeBrowsers: [{
browserName: "chrome",
url: seleniumGridAddress
}, {
browserName: "firefox",
url: seleniumGridAddress
}],
webserver: {
hostname: hostname
},
plugins: {
local: false,
sauce: false,
}
}
测试运行失败并显示此堆栈跟踪:
ERROR: Server failed to start: Error: No available ports. Ports tried: [8081,8000,8001,8003,8031,2000,2001,2020,2109,2222,2310,3000,3001,3030,3210,3333,4000,4001,4040,4321,4502,4503,4567,5000,5001,5050,5432,6000,6001,6060,6666,6543,7000,7070,7774,7777,8765,8777,8888,9000,9001,9080,9090,9876,9877,9999,49221,55001]
at /app/node_modules/polymer-cli/node_modules/polyserve/lib/start_server.js:384:15
at Generator.next (<anonymous>)
at fulfilled (/app/node_modules/polymer-cli/node_modules/polyserve/lib/start_server.js:17:58)
我试图按照以下方式修复它:polyserve 无法为应用程序提供服务,但没有成功。我也尝试设置hostname
为wct
因为这是 docker 网络中容器的已知主机名,但它显示相同的错误。
我真的不知道下一步该怎么做。任何帮助表示赞赏。