2

I'm was wondering how can I pass a different port number as argument when I'm running the selenium container instead of the default port(4444)

Usually I'm using:

docker run --shm-size=2G -d --net=host -e TZ=UTC -e SCREEN_WIDTH=1920 -e SCREEN_HEIGHT=1080  selenium/standalone-chrome:3.7.0

Is it possible to do so with the current selenium image or do I need to build a selenium image of my own and if so how to create that kind of image?

Captain_Meow_Meow
  • 2,341
  • 5
  • 31
  • 44

2 Answers2

1

You can bind port with -p

docker run -d -p 4444:4444 --name selenium-hub selenium/hub:3.8.1-aluminum

But if you want change the port inside container I think you must modify sources of image.

Kilian
  • 1,753
  • 13
  • 21
0

Not sure if this works with your docker image, it might help if you try to build your own image.

Use this image from GitHub https://github.com/SeleniumHQ/docker-selenium/tree/master/StandaloneChrome

Open entrypoint.sh and edit java ${JAVA_OPTS} -jar /opt/selenium/selenium-server-standalone.jar -role hub -port (custom port no.)

Then in dockerfile change EXPOES (custom port) Then build docker again

sanath meti
  • 5,179
  • 1
  • 21
  • 30