加入收藏 | 设为首页 | 会员中心 | 我要投稿 李大同 (https://www.lidatong.com.cn/)- 科技、建站、经验、云计算、5G、大数据,站长网!
当前位置: 首页 > 综合聚焦 > 服务器 > 安全 > 正文

如何通过docker-compose而不是使用docker启动selenium hub和一个

发布时间:2020-12-16 03:40:55 所属栏目:安全 来源:网络整理
导读:我可以通过以下方式启动硒中心图像: docker run --rm=true -P -p 4444:4444 --name selenium-hub selenium/hub 并通过以下方式添加firefox worker: docker run --rm=true --link selenium-hub:hub selenium/node-firefox 继续http://localhost:4444/grid/c

我可以通过以下方式启动硒中心图像:

docker run --rm=true -P -p 4444:4444  --name selenium-hub selenium/hub

并通过以下方式添加firefox worker:

docker run --rm=true --link selenium-hub:hub selenium/node-firefox

继续http://localhost:4444/grid/console然后将显示网格就好了.

我不想每次都使用docker,但是通过docker-compose进行相同的设置.

因此,我想我可以在docker-compose.yml中执行此操作:

selenium_hub:
    image: selenium/hub
    ports: ["4444:4444"]
    links:
        - selenium_firefox_worker
selenium_firefox_worker:
    image: selenium/node-firefox

然而在运行docker-compose之后我得到了消息:

selenium_firefox_node_1 | Not linked with a running Hub container
selenium_firefox_node_1 exited with code 1

因此网格不显示任何节点.

我以为我可能会以错误的顺序进行链接,但是:

selenium_hub:
    image: selenium/hub
    ports: ["4444:4444"]
selenium_firefox_node:
    image: selenium/node-firefox
    links:
        - selenium_hub

产生相同的错误.

我究竟做错了什么?

最佳答案
selenium_hub:
    image: selenium/hub
    ports: ["4444:4444"]
selenium_firefox_node:
    image: selenium/node-firefox
    links:
        - "selenium_hub:hub"

虽然k0pernikus’ answer确实有效,但我只是想详细说明它失败的原因.

节点容器希望连接到一个可以简单解析的集线器:

hub

而不是在他们的例子中,它将被解析为:

selenium_hub

(编辑:李大同)

【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容!

    推荐文章
      热点阅读