我正在使用网格配置来运行selenium测试。docker-compose up运行良好,我可以看到用于chrome、firefox和opera的单个容器。
docker-compose up

但是,当我试图使用docker-compose scale chrome=3创建容器节点时,就会出现以下错误。我尝试过很多种方法,比如改变Linux实例,sudo service docker restart,我不会放过它的。请帮助如何扩大镀铬容器。
docker-compose scale chrome=3

Cannot start service chrome: driver failed programming external connectivity on endpoint ec2-user_chrome_3 (f0d153ee59169eaf94501b8dc9e77db4157614afd731cba673f2aed6c054d237): Bind for 0.0.0.0:6900 failed: port is already allocateddocker-compose.yml
# 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:
chrome:
image: selenium/node-chrome:4.0.0-beta-1-prerelease-20210114
volumes:
- /dev/shm:/dev/shm
depends_on:
- selenium-hub
environment:
- SE_EVENT_BUS_HOST=selenium-hub
- SE_EVENT_BUS_PUBLISH_PORT=4442
- SE_EVENT_BUS_SUBSCRIBE_PORT=4443
ports:
- "6900:5900"
firefox:
image: selenium/node-firefox:4.0.0-beta-1-prerelease-20210114
volumes:
- /dev/shm:/dev/shm
depends_on:
- selenium-hub
environment:
- SE_EVENT_BUS_HOST=selenium-hub
- SE_EVENT_BUS_PUBLISH_PORT=4442
- SE_EVENT_BUS_SUBSCRIBE_PORT=4443
ports:
- "6901:5900"
opera:
image: selenium/node-opera:4.0.0-beta-1-prerelease-20210114
volumes:
- /dev/shm:/dev/shm
depends_on:
- selenium-hub
environment:
- SE_EVENT_BUS_HOST=selenium-hub
- SE_EVENT_BUS_PUBLISH_PORT=4442
- SE_EVENT_BUS_SUBSCRIBE_PORT=4443
ports:
- "6902:5900"
selenium-hub:
image: selenium/hub:4.0.0-beta-1-prerelease-20210114
container_name: selenium-hub
ports:
- "4442:4442"
- "4443:4443"
- "4444:4444"发布于 2021-01-26 13:48:43
这是因为您的节点被配置为将VNC端口公开到某个主机端口,并且当您启动多个节点时,它们都试图绑定在该端口上。
而不是:
ports:
- "6901:5900"你需要使用:
ports:
- "5900"这将使您的码头组合,以暴露容器端口的一个随机选择的自由端口的主机。
https://stackoverflow.com/questions/65902022
复制相似问题