I'm trying to run selenium hub with nodes generated dynamically with docker. Here is my docker compose file.
node-docker:
image: selenium/node-docker:${SELENIUM_DOCKER_TAG}
container_name: node-docker
volumes:
- ${SELENIUM_ASSETS}:/opt/selenium/assets
- ./config.toml:/opt/bin/config.toml
- /var/run/docker.sock:/var/run/docker.sock
depends_on:
- selenium-hub
environment:
- SE_EVENT_BUS_HOST=selenium-hub
- SE_EVENT_BUS_PUBLISH_PORT=4442
- SE_EVENT_BUS_SUBSCRIBE_PORT=4443
- SE_VNC_VIEW_ONLY=1
- SE_VNC_NO_PASSWORD=1
- TZ=${SELENIUM_TZ}
- NODE_OVERRIDE_MAX_SESSIONS=${SELENIUM_OVERRIDE_MAX_SESSIONS}
- NODE_MAX_SESSIONS=${SELENIUM_MAX_SESSIONS}
restart: always
selenium-hub:
image: selenium/hub:${SELENIUM_DOCKER_TAG}
container_name: selenium-hub
ports:
- "4442:4442"
- "4443:4443"
- "4444:4444"
environment:
- SE_OPTS=--allow-cors true
- TZ=${SELENIUM_TZ}
restart: always
And the config.toml file is as follow:
[docker]
# Configs have a mapping between the Docker image to use and the capabilities that need to be matched to
# start a container with the given image.
configs = [
"selenium/standalone-firefox:4.4.0-20220812", "{\"browserName\": \"firefox\"}",
"selenium/standalone-chrome:4.4.0-20220812", "{\"browserName\": \"chrome\"}",
"selenium/standalone-edge:4.4.0-20220812", "{\"browserName\": \"MicrosoftEdge\"}"
]
# URL for connecting to the docker daemon
# Most simple approach, leave it as http://127.0.0.1:2375, and mount /var/run/docker.sock.
# 127.0.0.1 is used because interally the container uses socat when /var/run/docker.sock is mounted
# If var/run/docker.sock is not mounted:
# Windows: make sure Docker Desktop exposes the daemon via tcp, and use http://host.docker.internal:2375.
# macOS: install socat and run the following command, socat -4 TCP-LISTEN:2375,fork UNIX-CONNECT:/var/run/docker.sock,
# then use http://host.docker.internal:2375.
# Linux: varies from machine to machine, please mount /var/run/docker.sock. If this does not work, please create an issue.
url = "http://127.0.0.1:2375"
# Docker image used for video recording
video-image = "selenium/video:ffmpeg-4.3.1-20220812"
# Uncomment the following section if you are running the node on a separate VM
# Fill out the placeholders with appropriate values
#[server]
#host = <ip-from-node-machine>
#port = <port-from-node-machine>
My problem is that the container generated dynamically has a UTC timezone instead of my timezone (America/Montreal) set in my environment variables.
To set the timezone for dynamic container we need de set
"se:timeZone"
in browser option capabilities.