更改selenium hub默认端口docker-compose

时间:2016-11-15 16:26:20

标签: selenium docker docker-compose

我有多个jenkins作业,每次尝试启动一个selenium独立容器,虽然当多个作业在同一个jenkins slave中并行运行时,会抛出以下错误:

0.0.0.0:4444 failed: port is already allocated

这是公平的,因为selenium standalone的默认端口设置为4444.我的问题是我如何覆盖selenium独立端口?我认为它与ports: ...有关,但显然不是......任何想法?

下面是我的docker-compose文件:

maven:
  build: "."
  links:
    - "selenium:selenium"
  working_dir: /code/
  volumes:
    - ".:/code"
  entrypoint:
  - mvn
  - verify
  - -Dwebdriver.remote.url=http://selenium:4444/wd/hub
selenium:
    image: selenium/standalone-chrome:latest
    ports:
      - "4444:4444"

我有另一个docker-compose文件,略有不同,例如:

maven_2:
  build: "."
  links:
    - "selenium_2:selenium_2"
  working_dir: /code/
  volumes:
    - ".:/code"
  entrypoint:
  - mvn
  - verify
  - -Dsome.additional.tags=test
  - -Dwebdriver.remote.url=http://selenium_2:4444/wd/hub
selenium_2:
    image: selenium/standalone-chrome:latest
    ports:
      - "4444:4444"

0 个答案:

没有答案