Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

askthedev.com Logo askthedev.com Logo
Sign InSign Up

askthedev.com

Search
Ask A Question

Mobile menu

Close
Ask A Question
  • Ubuntu
  • Python
  • JavaScript
  • Linux
  • Git
  • Windows
  • HTML
  • SQL
  • AWS
  • Docker
  • Kubernetes
Home/ Questions/Q 14993
Next
In Process

askthedev.com Latest Questions

Asked: September 27, 20242024-09-27T04:39:19+05:30 2024-09-27T04:39:19+05:30In: Docker

How can I install a specific version of Chrome in a Dockerfile? I’m looking for a solution that allows me to set a particular version for consistent testing and development purposes. Any guidance on the necessary steps or commands would be appreciated.

anonymous user

I’m working on a project where I need to have a specific version of Chrome running in a Docker container for consistent testing and development. The thing is, I’ve hit a bit of a wall when it comes to figuring out how to pull in that specific version. I really don’t want to deal with the headaches of version mismatches or unpredictable behavior, so nailing down the version is super important for me.

I’ve tried to follow a few tutorials I found online, but most of them focus on the latest version or just give you generic instructions that don’t quite fit my use case. Some even use outdated methods which I’d rather avoid. Right now, I’m leaning towards using a base image like `ubuntu` or `debian` for my Dockerfile, but I’m unsure how to go about installing Chrome after that.

What I think I need is a piece of guidance regarding the correct installation commands in the Dockerfile. I know that Chrome is typically installed via a `.deb` package for Ubuntu-based systems, but I’m not entirely clear on how to specify the version I want in the Dockerfile. Is there a specific URL where I can find the version I need, or do I have to dig through GitHub releases or something like that?

Also, once I have that version down, I’m curious if there are any specific configuration steps I should follow to ensure that Chrome runs smoothly within the container. Should I be concerned about any dependencies or packages that need to be included, especially if I’m trying to run tests that might require a graphical interface?

It would be awesome if someone could share a basic example of a Dockerfile or just the key commands I need to include to achieve this. I’m hoping to avoid any common pitfalls or mistakes that might come from my inexperience with Docker and Chrome version management. Any insights or personal experiences you have would be greatly appreciated!

  • 0
  • 0
  • 2 2 Answers
  • 0 Followers
  • 0
Share
  • Facebook

    Leave an answer
    Cancel reply

    You must login to add an answer.

    Continue with Google
    or use

    Forgot Password?

    Need An Account, Sign Up Here
    Continue with Google

    2 Answers

    • Voted
    • Oldest
    • Recent
    1. anonymous user
      2024-09-27T04:39:20+05:30Added an answer on September 27, 2024 at 4:39 am

      Dockerize a Specific Version of Chrome

      So you’re looking to run a specific version of Chrome in a Docker container. That’s definitely a smart move for testing consistency! Here’s a simple way to go about it.

      1. Find the Version You Need

      You can find the specific version of Chrome you want on Chromium’s version documentation or you can check the Chrome old version site for direct download links.

      2. Starting with a Dockerfile

      Here’s a basic Dockerfile example to get you started:

              
                  FROM ubuntu:20.04
      
                  # Install dependencies
                  RUN apt-get update && apt-get install -y \
                      wget \
                      gnupg2 \
                      && rm -rf /var/lib/apt/lists/*
      
                  # Add Google Chrome's public key and repository
                  RUN wget -q -O - https://dl.google.com/linux/linux_signing_key.pub | apt-key add - \
                      && echo "deb [arch=amd64] https://dl.google.com/linux/chrome/deb/ stable main" > /etc/apt/sources.list.d/google-chrome.list
      
                  # Specify the version you want
                  RUN apt-get update && apt-get install -y google-chrome-stable=SPECIFIC_VERSION_HERE
      
                  CMD ["google-chrome-stable", "--no-sandbox"]
              
          

      3. Replace the Version

      Don’t forget to replace SPECIFIC_VERSION_HERE with the version number you want. For example, it might look something like google-chrome-stable=89.0.4389.114-1.

      4. A Few Dependencies

      If you’re planning to run tests that require a graphical interface, you might also want to look into installing a virtual display server like Xvfb. You can add this to your Dockerfile:

              
                  RUN apt-get install -y xvfb
              
          

      5. Build and Run Your Container

      After you have your Dockerfile set up, build your image with:

              
                  docker build -t my-chrome-container .
              
          

      Then run it using:

              
                  docker run --rm -it my-chrome-container
              
          

      6. Troubleshooting

      If Chrome doesn’t work as expected, make sure you’re using the right version and check for any additional dependencies that might need to be installed.

      Good luck with your project! Hope this helps you avoid the version mismatch headaches!

        • 0
      • Reply
      • Share
        Share
        • Share on Facebook
        • Share on Twitter
        • Share on LinkedIn
        • Share on WhatsApp
    2. anonymous user
      2024-09-27T04:39:21+05:30Added an answer on September 27, 2024 at 4:39 am

      To install a specific version of Chrome in a Docker container, you can use a Dockerfile that pulls from a base image like `ubuntu` or `debian`. Below is a basic structure of a Dockerfile that demonstrates how to achieve this. Start by determining the exact version of Chrome you’d like to install; you can find the versioned `.deb` packages at Chrome for Testing. Use the `curl` command to download the package directly into your container. Replace `` with the specific version number you wish to install:

      
      FROM ubuntu:20.04
      
      # Install necessary packages
      RUN apt-get update && apt-get install -y \
          wget \
          libx11-xcb1 \
          libxcomposite1 \
          libxcursor1 \
          libxi6 \
          libxtst6 \
          libsdtp1 \
          && rm -rf /var/lib/apt/lists/*
      
      # Install a specific version of Chrome
      RUN wget https://dl.google.com/linux/direct/google-chrome-stable_current_amd64.deb && \
          dpkg -i google-chrome-stable_current_amd64.deb; \
          apt-get install -f -y; \
          rm google-chrome-stable_current_amd64.deb
      
      

      Make sure to include any dependencies Chrome may require for proper functionality before running your tests. If you plan to run automated tests that require a graphical interface, consider using a headless mode or setting up Xvfb (X virtual framebuffer) to simulate the display environment in the Docker container. For example, you could add the command to install Xvfb in your Dockerfile as follows:

      
      RUN apt-get install -y xvfb
      
      

      Finally, to run Chrome in headless mode, you should configure your test scripts to include the `–headless` flag when launching Chrome. By following these steps and frameworks, you should be able to maintain a stable environment suitable for your development and testing tasks.

        • 0
      • Reply
      • Share
        Share
        • Share on Facebook
        • Share on Twitter
        • Share on LinkedIn
        • Share on WhatsApp

    Related Questions

    • I'm trying to run a Docker container that requires access to my X11 display, but I'm encountering issues with setting up the display environment. Despite following the usual procedures for ...
    • can't connect to local mysql server through socket '/tmp/mysql.sock' docker
    • Do all Docker images inherently consist of a minimal operating system?
    • How can I set up the most recent version of Node.js in a Docker container?
    • I'm encountering an issue when trying to run a Docker container, specifically receiving an error message that states there was a failure in creating a shim task due to an ...

    Sidebar

    Related Questions

    • I'm trying to run a Docker container that requires access to my X11 display, but I'm encountering issues with setting up the display environment. Despite ...

    • can't connect to local mysql server through socket '/tmp/mysql.sock' docker

    • Do all Docker images inherently consist of a minimal operating system?

    • How can I set up the most recent version of Node.js in a Docker container?

    • I'm encountering an issue when trying to run a Docker container, specifically receiving an error message that states there was a failure in creating a ...

    • Where can I locate the Ubuntu Minimal 22.04 Docker image?

    • I am trying to install Docker Engine on my system, but I am encountering an issue where the package manager is unable to find the ...

    • If I uninstall Docker, will it also delete my existing containers and images?

    • I am facing an issue with Docker where I encounter an error indicating that there is no such file or directory at /var/lib/docker/overlay2//merged. This problem ...

    • What methods can be employed to monitor and analyze the memory consumption of Docker containers?

    Recent Answers

    1. anonymous user on Create a program that generates mock prime numbers using ASCII text representation.
    2. anonymous user on Create a program that generates mock prime numbers using ASCII text representation.
    3. anonymous user on How can I optimize the palette cycling function in my Unity shader for better performance?
    4. anonymous user on How can I optimize the palette cycling function in my Unity shader for better performance?
    5. anonymous user on Generate the number 2025 in any human language while omitting specific characters in your code.
    • Home
    • Learn Something
    • Ask a Question
    • Answer Unanswered Questions
    • Privacy Policy
    • Terms & Conditions

    © askthedev ❤️ All Rights Reserved

    Explore

    • Ubuntu
    • Python
    • JavaScript
    • Linux
    • Git
    • Windows
    • HTML
    • SQL
    • AWS
    • Docker
    • Kubernetes

    Insert/edit link

    Enter the destination URL

    Or link to existing content

      No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.