You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Thanks for contributing to the Docker-Selenium project! A PR well described will help maintainers to quickly review and merge it
Before submitting your PR, please check our contributing guidelines, applied for this repository.
Avoid large PRs, help reviewers by making them as simple and short as possible.
Description
Fixes#2829 (Scope in node-chrome, standalone-chrome - arch linux/amd64)
There are 2 ways of usage of this feature.
Upgrade Chrome and ChromeDriver later in runtime (when starting the container)
Set the container environment SE_UPDATE_CHROME_COMPONENTS to true
Example
Tradeoff:
Note that after the container gets restarted, updated binaries will be lost unless you call the update script within the build container process (the second usage below).
Build your own image by reusing image layers with upgrading Chrome and ChromeDriver to the latest
Create a simple Dockerfile as below
FROM --platform=linux/amd64 selenium/standalone-chrome:latest
RUN /opt/bin/update-chrome-components.sh
Add runtime Chrome/ChromeDriver update capability via environment variable
Refactor installation scripts into modular, reusable components
Support both runtime updates and build-time customization
Enable automatic version detection and architecture handling
Changes diagram
flowchart LR
A["Container Start"] --> B["Check SE_UPDATE_CHROME_COMPONENTS"]
B --> C["Run update-chrome-components.sh"]
C --> D["Install Chrome via install-chrome.sh"]
C --> E["Install ChromeDriver via install-chromedriver.sh"]
D --> F["Updated Chrome Binary"]
E --> G["Updated ChromeDriver Binary"]
• Update Chrome/ChromeDriver to the latest version when starting the container
• Provide a script that updates to the latest version of Chrome when the container starts
Requires further human verification:
• Verify that the update mechanism works correctly across different Chrome versions and architectures
• Test that the runtime update functionality works as expected in container environments
• Validate that the sudo requirements and permissions work correctly in various deployment scenarios
The script requires sudo access to function, which may not be available in all container environments. The script exits gracefully but this limitation should be clearly documented and may affect usability.
# Check if we have sudo accessif! sudo -n true2>/dev/null;thenecho"Warning: No sudo access available. Chrome components update skipped."echo"To enable updates, ensure the container user has sudo privileges."exit 0
fi
The script assumes specific file extraction patterns and uses conditional moves that may fail silently. The logic for handling different ChromeDriver archive structures could be more robust.
The script downloads packages from external URLs without retry logic or fallback mechanisms. Network failures could cause installation to fail without proper error handling.
The hardcoded architecture linux64 in the URL doesn't respect the detected DRIVER_ARCH variable for Chrome versions < 115. This could cause failures on non-amd64 architectures.
if [ $CHROME_MAJOR_VERSION -lt 115 ]; then
# Use old ChromeDriver API for versions < 115
echo "Getting ChromeDriver latest version from https://chromedriver.storage.googleapis.com/LATEST_RELEASE_${CHROME_MAJOR_VERSION}"
CHROME_DRIVER_VERSION=$(wget -qO- https://chromedriver.storage.googleapis.com/LATEST_RELEASE_${CHROME_MAJOR_VERSION} | sed 's/\r$//')
- CHROME_DRIVER_URL="https://chromedriver.storage.googleapis.com/$CHROME_DRIVER_VERSION/chromedriver_linux64.zip"+ CHROME_DRIVER_URL="https://chromedriver.storage.googleapis.com/$CHROME_DRIVER_VERSION/chromedriver_${DRIVER_ARCH}.zip"
fi
[To ensure code accuracy, apply this suggestion manually]
Suggestion importance[1-10]: 9
__
Why: The suggestion correctly identifies a bug where the script hardcodes linux64 for older Chrome versions, which would cause it to fail on other architectures like aarch64.
High
Add missing error handling
Add error handling for cases where neither extraction pattern matches. The script should fail gracefully if the ChromeDriver binary is not found in expected locations after extraction.
# Handle different extraction patterns
if [ -f "/opt/selenium/chromedriver" ]; then
mv /opt/selenium/chromedriver /opt/selenium/chromedriver-$CHROME_DRIVER_VERSION
elif [ -f "/opt/selenium/chromedriver-${DRIVER_ARCH}/chromedriver" ]; then
mv /opt/selenium/chromedriver-${DRIVER_ARCH}/chromedriver /opt/selenium/chromedriver-$CHROME_DRIVER_VERSION
rm -rf /opt/selenium/chromedriver-${DRIVER_ARCH}
+else+ echo "Error: ChromeDriver binary not found after extraction"+ exit 1
fi
Apply / Chat
Suggestion importance[1-10]: 7
__
Why: While set -e would cause the script to fail on a subsequent command, adding an explicit error message and exit improves debuggability by clarifying why the script failed.
Medium
General
Use proper exit code
The script exits silently when sudo access is unavailable, which could mask configuration issues. Consider using a non-zero exit code to indicate the update couldn't be performed due to insufficient privileges.
# Check if we have sudo access
if ! sudo -n true 2>/dev/null; then
echo "Warning: No sudo access available. Chrome components update skipped."
echo "To enable updates, ensure the container user has sudo privileges."
- exit 0+ exit 1
fi
Apply / Chat
Suggestion importance[1-10]: 6
__
Why: Exiting with a non-zero status code when the update is skipped due to lack of sudo access correctly signals a non-successful state, which is better for automation.
The action failed because the Docker image selenium/node-base:4.34.0-20250606 was not found in the Docker registry. The build process failed when trying to build the Chrome node image, which depends on this base image. The error occurred at line 4 of the Dockerfile when trying to pull FROM ${NAMESPACE}/${BASE}:${VERSION} where the resolved image was selenium/node-base:4.34.0-20250606. Subsequently, the test also failed because it couldn't find the selenium/hub:4.34.0-20250606 image when trying to launch the Hub container.
The action failed because Docker images with the tag 4.34.0-20250606 could not be found on Docker Hub. Specifically: • Docker build failed for selenium/node-base:4.34.0-20250606 with error "not found" • Test execution failed when trying to pull selenium/hub:4.34.0-20250606 with error "not found" • The error occurred at line 4 in the Dockerfile: FROM ${NAMESPACE}/${BASE}:${VERSION} • Multiple retry attempts all failed with the same 404 errors from Docker registry
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
User description
Thanks for contributing to the Docker-Selenium project!
A PR well described will help maintainers to quickly review and merge it
Before submitting your PR, please check our contributing guidelines, applied for this repository.
Avoid large PRs, help reviewers by making them as simple and short as possible.
Description
Fixes #2829 (Scope in node-chrome, standalone-chrome - arch linux/amd64)
There are 2 ways of usage of this feature.
Set the container environment
SE_UPDATE_CHROME_COMPONENTS
totrue
Example
docker run -d -p 4444:4444 -p 5900:5900 --shm-size="2g" -e SE_UPDATE_CHROME_COMPONENTS=true selenium/standalone-chrome:latest
Tradeoff:
Note that after the container gets restarted, updated binaries will be lost unless you call the update script within the build container process (the second usage below).
Create a simple Dockerfile as below
docker buildx build --platform linux/amd64 -t selenium/standalone-chrome:my-latest .
Motivation and Context
Types of changes
Checklist
PR Type
Enhancement
Description
Add runtime Chrome/ChromeDriver update capability via environment variable
Refactor installation scripts into modular, reusable components
Support both runtime updates and build-time customization
Enable automatic version detection and architecture handling
Changes diagram
Changes walkthrough 📝
7 files
Add Chrome components update check at startup
Create modular Chrome installation script
Create modular ChromeDriver installation script
Add runtime update orchestration script
Add Chrome components update check at startup
Refactor to use modular installation scripts
Add error handling and shebang improvement