docker - 通过别名在另一个容器的反向代理后面访问 Docker 容器
问题描述
我正在尝试在包含 Cypress 的 Docker 容器内使用 ZAP-Docker 作为 yml 文件服务(端到端测试执行)。我使用 ZAP 作为反向代理,其想法是将流量从赛普拉斯转移到 ZAP。但是,正如您可以想象的那样,我不能使用 zap 容器的 IP 地址。所以我正在尝试使用别名的解决方案。
这是 yml 文件的一部分:
services:
- name: owasp/zap2docker-stable:latest
alias: zap
ports:
- "8092:8092"
entrypoint: ["zap.sh"]
command: ["-daemon", "-port", "8092", "-host", "0.0.0.0", "-config", "api.disablekey=true", "-config", "api.addrs.addr.name=.*", "-config", "api.addrs.addr.regex=true"]
这是我用来将流量转移到 ZAP 容器的命令(使用它的别名)
HTTP_PROXY=http://zap:8092 npx cypress run
赛普拉斯文档在这里
不幸的是,我通过执行测试从赛普拉斯得到了这个错误:
Cypress could not verify that this server is running:
> https://app.cloud
We are verifying this server because it has been configured as your `baseUrl`.
Cypress automatically waits until your server is accessible before running tests.
解决方案
推荐阅读
- node.js - 如何测试节点服务的“FormData”请求?
- python - 在尝试搜索特定文本时卡在“while”循环中
- api-key - Guidewire InsuranceSuite 10 在进行 API 调用时可以使用自定义标头吗?
- database - watermelonDb:如何在模式中将字符串数组作为列类型传递?
- javascript - 用 JS 关闭 py 终端
- c# - 事件在错误的按钮上触发
- cypress - 在 Cypress 中重载自定义命令
- php - 当帖子分配给多个时,如何仅显示特定分配的类别
- python - Factoranalyzer 使用 Python 3.5 和 Python 3.7 计算不同的分数
- woocommerce - 从现有的 WC_Order_Item_Product 创建订单?