If you're using a Windows container agent, and want to install Google Chrome, then please try the below steps:
- Here, you can modify your Dockerfile to install Chrome:
# Use your existing Windows base image FROM mcr.microsoft.com/windows/servercore:ltsc2022 SHELL ["powershell", "-Command"] # Download and install Google Chrome silently RUN Invoke-WebRequest -Uri "https://dl.google.com/chrome/install/latest/chrome_installer.exe" -OutFile "chrome_installer.exe" ; \ Start-Process -FilePath "chrome_installer.exe" -ArgumentList "/silent /install" -NoNewWindow -Wait ; \ Remove-Item -Force "chrome_installer.exe" # OPTIONAL: Add Chrome to PATH manually if needed # ENV PATH="C:\\Program Files\\Google\\Chrome\\Application\\:${PATH}" - After updating your Dockerfile, rebuild your image:
docker build -t my-windows-agent . docker run --name windows-agent-container my-windows-agent - To verify that Chrome is installed inside the container, add the below simple pipeline task:
- powershell: | $chromePath = "C:\Program Files\Google\Chrome\Application\chrome.exe" if (Test-Path $chromePath) { Write-Host "✅ Google Chrome installed successfully!" } else { Write-Error "❌ Chrome not found!" } displayName: 'Check Chrome Installation'
Additional References:
https://github.com/c0b/chrome-in-docker
Hope this helps!
Please Let me know if you have any queries.
If you found the information helpful, please click "Upvote" on the post to let us know and consider accepting the answer as the token of appreciation. Thank You.