Share via

Installing google chrome on window container agent

Shyam Kumar 911 Reputation points
2025-05-28T12:24:33.7933333+00:00

I am planning to install google chrome on windows container agent, that means I should start from updating in docker file , can you suggest?

note: it is windows container - powershell

Azure DevOps
0 comments No comments

Answer accepted by question author

  1. Durga Reshma Malthi 11,595 Reputation points Microsoft External Staff Moderator
    2025-05-28T13:03:17.49+00:00

    Hi Diptesh Kumar

    If you're using a Windows container agent, and want to install Google Chrome, then please try the below steps:

    1. 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}"
      
    2. After updating your Dockerfile, rebuild your image:
         docker build -t my-windows-agent .
         docker run --name windows-agent-container my-windows-agent
      
    3. 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.

    Was this answer helpful?

    1 person found this answer helpful.
    0 comments No comments

1 additional answer

Sort by: Most helpful
  1. Shyam Kumar 911 Reputation points
    2025-05-28T15:47:03.9333333+00:00

    Hi Durga,

    Can you please respond in private message, I got few questions related to directory path to be mentioned in dockerfile

    Was this answer helpful?

    0 comments No comments

Your answer

Answers can be marked as 'Accepted' by the question author and 'Recommended' by moderators, which helps users know the answer solved the author's problem.