How to change port of selenium/hub docker container? How to change port of selenium/hub docker container? docker docker

How to change port of selenium/hub docker container?


You can change the ports using the SE_OPTS environment variable: just add

environment:  SE_OPTS: "-port <YOUR_PREFERED_PORT>"

to your docker-compose.yml and Selenium will start at <YOUR_PREFERED_PORT>.

See https://github.com/SeleniumHQ/docker-selenium#se_opts-selenium-configuration-options


Just do a find and replace of 4444 with whatever port you want to use. For example, use 4440 instead of 4444.

version: "3"services:  selenium-hub:    restart: always    image: selenium/hub:latest    ports:      - "4440:4440"    environment:      - GRID_BROWSER_TIMEOUT=300      - GRID_TIMEOUT=300selenium-chrome:  restart: always  image: selenium/node-chrome:latest  depends_on:    - selenium-hub  volumes:    - /dev/shm:/dev/shm  links:    - selenium-hub:hub  environment:    - HUB_PORT_4440_TCP_ADDR=selenium-hub    - HUB_PORT_4440_TCP_PORT=4440    - JAVA_OPT=-Xmx512m    - DBUS_SESSION_BUS_ADDRESS=/dev/null    - no_proxy=localhost    - HUB_ENV_no_proxy=localhost    - GRID_BROWSER_TIMEOUT=300    - GRID_TIMEOUT=300selenium-firefox:  restart: always  image: selenium/node-firefox:latest  depends_on:    - selenium-hub  volumes:    - /dev/shm:/dev/shm  links:    - selenium-hub:hub  environment:    - HUB_PORT_4440_TCP_ADDR=selenium-hub    - HUB_PORT_4440_TCP_PORT=4440    - JAVA_OPT=-Xmx512m    - DBUS_SESSION_BUS_ADDRESS=/dev/null    - no_proxy=localhost    - HUB_ENV_no_proxy=localhost    - GRID_BROWSER_TIMEOUT=300    - GRID_TIMEOUT=300