我已经创建了测试自动化框架的坞映像。我正在使用docker-组合文件来运行chrome、firefox和edge的selenium (集线器和节点)。
但是,在运行容器时,我会得到以下错误。

,它在本地运行docker -组合文件时工作非常好,而不生成整个框架.的对接图像。
下面的是我一直在使用的对接组件.
# To execute this docker-compose yml file use `docker-compose -f docker-compose-v3.yml up`
# Add the `-d` flag at the end for detached execution
# To stop the execution, hit Ctrl+C, and then `docker-compose -f docker-compose-v3.yml down`
version: "3"
services:
selenium-hub:
image: selenium/hub:4.1.1-20211217
container_name: selenium-hub
ports:
- "4442:4442"
- "4443:4443"
- "4444:4444"
- "4445:4445"
chrome:
image: selenium/node-chrome:4.1.1-20211217
shm_size: 2gb
depends_on:
- selenium-hub
environment:
- SE_EVENT_BUS_HOST=selenium-hub
- SE_EVENT_BUS_PUBLISH_PORT=4444
- SE_EVENT_BUS_SUBSCRIBE_PORT=4444
edge:
image: selenium/node-edge:4.1.1-20211217
shm_size: 2gb
depends_on:
- selenium-hub
environment:
- SE_EVENT_BUS_HOST=selenium-hub
- SE_EVENT_BUS_PUBLISH_PORT=4444
- SE_EVENT_BUS_SUBSCRIBE_PORT=4444
firefox:
image: selenium/node-firefox:4.1.1-20211217
shm_size: 2gb
depends_on:
- selenium-hub
environment:
- SE_EVENT_BUS_HOST=selenium-hub
- SE_EVENT_BUS_PUBLISH_PORT=4444
- SE_EVENT_BUS_SUBSCRIBE_PORT=4444
opera:
image: selenium/node-opera:latest
shm_size: 2gb
depends_on:
- selenium-hub
environment:
- SE_EVENT_BUS_HOST=selenium-hub
- SE_EVENT_BUS_PUBLISH_PORT=4445
- SE_EVENT_BUS_SUBSCRIBE_PORT=4445
浏览器调用发生在下面
driver =(新的RemoteWebDriver(new (Remote_url),win_Options));// url是指向正在运行的码头容器的远程new驱动程序。
发布于 2022-04-02 19:16:55
对我来说,它通过在run命令中添加--network="host"来工作。
docker run -d --network="host" image-namehttps://stackoverflow.com/questions/70881881
复制相似问题