<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>DEV Community: sunim2022</title>
    <description>The latest articles on DEV Community by sunim2022 (@sunim2022).</description>
    <link>https://dev.to/sunim2022</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F912980%2Fd33f8759-0038-47d5-81c9-e1b96e01cb96.png</url>
      <title>DEV Community: sunim2022</title>
      <link>https://dev.to/sunim2022</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/sunim2022"/>
    <language>en</language>
    <item>
      <title>Run your Selenium tests inside docker container in Jenkins-Part 2</title>
      <dc:creator>sunim2022</dc:creator>
      <pubDate>Sat, 27 Aug 2022 18:45:00 +0000</pubDate>
      <link>https://dev.to/sunim2022/run-your-selenium-tests-inside-docker-container-in-jenkins-part-2-2iek</link>
      <guid>https://dev.to/sunim2022/run-your-selenium-tests-inside-docker-container-in-jenkins-part-2-2iek</guid>
      <description>&lt;p&gt;In my previous &lt;a href="https://dev.to/sunim2022/run-your-selenium-tests-inside-docker-container-part-1-4b02"&gt;post&lt;/a&gt;, I shared details on running selenium tests inside a docker container on your windows machine. Now let’s see how to run Jenkins in docker and then run selenium tests in Jenkins (inside a docker container).&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--oh_mUvjK--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/6mpxwchd41pgiwqgoex0.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--oh_mUvjK--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/6mpxwchd41pgiwqgoex0.png" alt="Jenkins in Docker" width="880" height="463"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Jenkins is most widely used CI/CD tool for building, testing and deploying applications.&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;&lt;a href="https://www.jenkins.io/doc/"&gt;https://www.jenkins.io/doc/&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;What is Jenkins?&lt;/p&gt;

&lt;p&gt;&lt;em&gt;Jenkins is a self-contained, open source automation server which can be used to automate all sorts of tasks related to building, testing, and delivering or deploying software.&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;&lt;em&gt;Jenkins can be installed through native system packages, Docker, or even run standalone by any machine with a Java Runtime Environment (JRE) installed.&lt;/em&gt;&lt;/p&gt;
&lt;/blockquote&gt;

&lt;h2&gt;
  
  
  Installing Jenkins (in Docker)
&lt;/h2&gt;

&lt;p&gt;&lt;strong&gt;Pre-requisites&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Understanding of Jenkins, &lt;a href="https://docs.docker.com/get-started/overview/"&gt;Docker&lt;/a&gt;, &lt;a href="https://docs.docker.com/network/"&gt;Docker networking&lt;/a&gt;, &lt;a href="https://docs.docker.com/storage/volumes/"&gt;Docker volumes&lt;/a&gt;&lt;br&gt;
Please follow instructions from here — &lt;a href="https://www.jenkins.io/doc/book/installing/docker/"&gt;https://www.jenkins.io/doc/book/installing/docker/&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;For Windows — &lt;a href="https://www.jenkins.io/doc/book/installing/docker/#on-windows"&gt;https://www.jenkins.io/doc/book/installing/docker/#on-windows&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Create a bridge network in docker&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;&lt;code&gt;docker network create jenkins&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Run a docker:dind Docker image&lt;/strong&gt;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;docker run 
--name jenkins-docker 
--rm 
--detach 
--privileged 
--network jenkins 
--network-alias docker 
--env DOCKER_TLS_CERTDIR=/certs 
--volume C:\Users\msuni\Docker\Jenkins-Volume\jenkins-docker-certs:/certs/client 
--volume C:\Users\msuni\Docker\Jenkins-Volume\jenkins-data:/var/jenkins_home 
--publish 2376:2376 docker:dind 
--storage-driver overlay2
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;Customize official Jenkins docker image&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Step 1: Create Dockerfile using the following content&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;FROM jenkins/jenkins:lts-jdk11
USER root
RUN apt-get update &amp;amp;&amp;amp; apt-get install -y lsb-release
RUN curl -fsSLo /usr/share/keyrings/docker-archive-keyring.asc \
https://download.docker.com/linux/debian/gpg
RUN echo “deb [arch=$(dpkg — print-architecture) \
signed-by=/usr/share/keyrings/docker-archive-keyring.asc] \
https://download.docker.com/linux/debian \
$(lsb_release -cs) stable” &amp;gt; /etc/apt/sources.list.d/docker.list
RUN apt-get update &amp;amp;&amp;amp; apt-get install -y docker-ce-cli
USER jenkins
RUN jenkins-plugin-cli — plugins “blueocean:1.25.6 docker-workflow:1.29”
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Step 2: Build your docker image&lt;/p&gt;

&lt;p&gt;&lt;code&gt;docker build -t jenkins-with-docker:0.1 .&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;Step 3: Run your custom image as container in Docker&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;docker run --name jenkins-blueocean 
--restart=on-failure 
--detach 
--network jenkins 
--env DOCKER_HOST=tcp://docker:2376 
--env DOCKER_CERT_PATH=/certs/client 
--env DOCKER_TLS_VERIFY=1 
--publish 8080:8080 
--publish 50000:50000 
--volume C:\Users\msuni\Docker\Jenkins-Volume\jenkins-data:/var/jenkins_home 
--volume C:\Users\msuni\Docker\Jenkins-Volume\jenkins-docker-certs:/certs/client:ro jenkins-with-docker:0.1
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Step 4: Follow &lt;a href="https://www.jenkins.io/doc/book/installing/docker/#setup-wizard"&gt;post-installation wizard&lt;/a&gt; to complete the remaining steps.&lt;/p&gt;

&lt;p&gt;Step 5: Create the admin user — follow &lt;a href="https://www.jenkins.io/doc/book/installing/docker/#creating-the-first-administrator-user"&gt;these instructions&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;After completing installation steps, you can now browse to &lt;a href="http://localhost:8080/login"&gt;http://localhost:8080/login&lt;/a&gt; and use the new admin user credentials to login.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--dpoMqy9h--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/an9mq0txhm4lvk6bvq6j.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--dpoMqy9h--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/an9mq0txhm4lvk6bvq6j.png" alt="Jenkins Dashboard" width="880" height="148"&gt;&lt;/a&gt;&lt;/p&gt;




&lt;p&gt;In my previous post, I created a custom image “&lt;em&gt;seleniumtests-in-docker&lt;/em&gt;”. In order to use the image from Jenkins, I pushed that image to docker hub public repository.&lt;/p&gt;

&lt;p&gt;Pre-requisites:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Sign up here: &lt;a href="https://hub.docker.com/signup"&gt;https://hub.docker.com/signup&lt;/a&gt;
&lt;/li&gt;
&lt;li&gt;You will be prompted to login using your email/id. You will asked to confirm your email address as well.&lt;/li&gt;
&lt;li&gt;After login, I selected Personal plan for $0 (which is the default plan with access to create unlimited public repositories).&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;Push custom image to docker hub&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Step 1: Create your repository&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--8A_l-rt0--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/hagj4xt48wr0l8fvxdy9.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--8A_l-rt0--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/hagj4xt48wr0l8fvxdy9.png" alt="Create Repository from Docker Hub" width="880" height="319"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Step 2: Create a new tag for your local image before it is pushed to docker hub&lt;/p&gt;

&lt;p&gt;&lt;code&gt;docker tag seleniumtests-in-docker:1.0 &amp;lt;username&amp;gt;/selenium-in-docker-demos:1.0&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;Step 3: Login to Docker Hub using docker cli&lt;/p&gt;

&lt;p&gt;&lt;code&gt;docker login -u &amp;lt;username&amp;gt; -p &amp;lt;password&amp;gt;&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;Step 4: Push your local image to docker hub. Run this command from your machine (replace username with yours)&lt;/p&gt;

&lt;p&gt;&lt;code&gt;docker push &amp;lt;username&amp;gt;/selenium-in-docker-demos:1.0&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;My image is available here: &lt;a href="https://hub.docker.com/r/sunipro2022/selenium-in-docker-demos"&gt;https://hub.docker.com/r/sunipro2022/selenium-in-docker-demos&lt;/a&gt;&lt;/p&gt;




&lt;p&gt;Now that the image is ready for use, let's create a new pipeline in Jenkins to run selenium tests.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Create Jenkins Pipeline&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Step 1: Login to Jenkins (&lt;a href="http://localhost:8080/"&gt;http://localhost:8080/&lt;/a&gt;)&lt;/p&gt;

&lt;p&gt;Step 2: Create a new Item&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--_V1weiGn--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/e7dlgogx4w4uqrw2jjcr.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--_V1weiGn--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/e7dlgogx4w4uqrw2jjcr.png" alt="Create a new Item" width="454" height="535"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Enter item name, select Pipeline and click on OK.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--o4FY_DmO--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/k1nlsaq4kcqwjf54k6nn.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--o4FY_DmO--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/k1nlsaq4kcqwjf54k6nn.png" alt="Create a new pipeline " width="880" height="730"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;You should see your pipeline configuration page. Navigate to Pipeline section.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--u0A-gc_9--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/tyowzbsh4kd9u16ici0p.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--u0A-gc_9--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/tyowzbsh4kd9u16ici0p.png" alt="Pipeline configuration" width="880" height="540"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;You can either use pipeline script option (enter _groovy script in the editor directly — another language to learn I guess :) _) or import your Jenkins file from SCM (like Git).&lt;/p&gt;

&lt;p&gt;I used the following pipeline script to run the image previously uploaded to Docker hub.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;pipeline {
 agent any
stages {
  stage('Run demo tests') {
   steps {
     sh('docker run sunipro2022/selenium-in-docker-demos:1.0 ')
   }
  }
 }
}
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Pipeline logs&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--9NzaGOdg--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/psbekcm21vebl1hm5dui.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--9NzaGOdg--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/psbekcm21vebl1hm5dui.png" alt="Jenkins pipeline Console logs" width="880" height="447"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--WCau1-UO--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/i17ckn7ucjfxisai434b.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--WCau1-UO--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/i17ckn7ucjfxisai434b.png" alt="Stage view" width="667" height="412"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;So far, the pipeline executed tests with default browser (chrome).&lt;/p&gt;

&lt;p&gt;Let’s see how to run cross browser tests using the same image.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Update Jenkins pipeline to use parameters&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;For more information on Jenkins parameters, please refer to this documentation: &lt;a href="https://www.jenkins.io/doc/book/pipeline/syntax/#parameters"&gt;https://www.jenkins.io/doc/book/pipeline/syntax/#parameters&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Step 1: Update pipeline script to add the parameter in parameters section, and update the docker run command to pass BROWSER parameter value as environment variable.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;pipeline {
    agent any
    parameters {
      string defaultValue: 'Chrome', name: 'BROWSER', description: 'Select between Chrome and Firefox browsers.'
    }
    stages {
      stage('Run demo tests') {
       steps {
         sh("docker run --rm --env 'env_browser_param=${params.BROWSER}' sunipro2022/selenium-in-docker-demos:1.0  ")
       }
      }
     }
}
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Apply pipeline changes.&lt;/p&gt;

&lt;p&gt;Submit “Build with parameters” as shown below.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--j2Tqaj2Z--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/veukjb337bpbmixrsa7x.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--j2Tqaj2Z--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/veukjb337bpbmixrsa7x.png" alt="Build with parameters option" width="880" height="292"&gt;&lt;/a&gt;&lt;/p&gt;




&lt;p&gt;&lt;strong&gt;Conclusion:&lt;/strong&gt;&lt;br&gt;
This post explains how to work with Jenkins and docker in your local environment. I hope it will be useful to newbies like me who are in their journey to learn Jenkins, Docker &amp;amp; looking to run Selenium tests from Jenkins.&lt;/p&gt;

&lt;p&gt;I appreciate you taking time to read my post.&lt;/p&gt;

</description>
      <category>seleniumwebdriver</category>
      <category>jenkins</category>
      <category>docker</category>
      <category>selenium</category>
    </item>
    <item>
      <title>Run your Selenium tests inside docker container - Part 1</title>
      <dc:creator>sunim2022</dc:creator>
      <pubDate>Sat, 27 Aug 2022 14:10:00 +0000</pubDate>
      <link>https://dev.to/sunim2022/run-your-selenium-tests-inside-docker-container-part-1-4b02</link>
      <guid>https://dev.to/sunim2022/run-your-selenium-tests-inside-docker-container-part-1-4b02</guid>
      <description>&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--NKjZNnZ1--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/w1q9s6z6hif36oyxvukg.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--NKjZNnZ1--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/w1q9s6z6hif36oyxvukg.png" alt="Selenium &amp;amp; Docker in Windows&amp;lt;br&amp;gt;
" width="880" height="314"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;I started my career in manual testing with a pharmaceutical company. Outside of my application testing activities, I used to help my product team with deployments in test environments. Testing and deployments, both were manual. I always wanted to automate testing and reduce the number of hours I spent on executing multiple steps to deploy the product in test regions.&lt;br&gt;
Selenium was the only automation framework I was aware of back in 2012, and so I kick-started my test automation journey with Selenium and Java last year.&lt;br&gt;
I constantly had to deal with different versions and types of browsers. After researching a bit online, realized that docker could help simplify my local testing (had no clue what docker was until this point). It was time to learn docker and obviously it had to start with "docker run hello-world" :). I installed docker-desktop.&lt;/p&gt;



&lt;p&gt;After watching countless videos on YouTube, only things I dreamed about for a week were virtual machines, containers and docker!&lt;br&gt;
Went from hello-world to building my own image (not really huh !?) with Chrome &amp;amp; Firefox dependencies.&lt;br&gt;
To run Selenium tests, I have always used&lt;br&gt;
&lt;code&gt;mvn test&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;So maven had to be the base image.&lt;br&gt;
&lt;code&gt;FROM maven:3.8.6-jdk-11&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;Added following dependencies to work with Chrome and its Driver.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;# Install Chrome.
RUN wget -q -O - https://dl-ssl.google.com/linux/linux_signing_key.pub | apt-key add -
RUN sh -c 'echo "deb http://dl.google.com/linux/chrome/deb/ stable main" &amp;gt;&amp;gt; /etc/apt/sources.list.d/google-chrome.list'
RUN apt-get update
RUN apt-get install -y google-chrome-stable
# Install ChromeDriver.
RUN wget -N https://chromedriver.storage.googleapis.com/105.0.5195.19/chromedriver_linux64.zip -P ~/
RUN unzip ~/chromedriver_linux64.zip -d ~/
RUN rm ~/chromedriver_linux64.zip
RUN mv -f ~/chromedriver /usr/local/bin/chromedriver
RUN chmod +x /usr/local/bin/chromedriver
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Next (And thanks to Selenium team for sharing this Dockerfile and this &lt;a href="https://stackoverflow.com/questions/65813715/how-to-apt-get-install-firefox-on-an-openjdk11-docker-base-image-without-no-in/65833662#65833662"&gt;post &lt;/a&gt;on stackoverflow) I was able to add Firefox dependencies to my Dockerfile.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;# Install Firefox
ARG FIREFOX_VERSION=103.0.2
RUN echo "deb http://deb.debian.org/debian/ unstable main contrib non-free" &amp;gt;&amp;gt; /etc/apt/sources.list.d/debian.list
RUN apt-get update -qqy \
&amp;amp;&amp;amp; apt-get -qqy --no-install-recommends install firefox \
&amp;amp;&amp;amp; rm -rf /var/lib/apt/lists/* /var/cache/apt/* \
&amp;amp;&amp;amp; wget --no-verbose -O /tmp/firefox.tar.bz2 https://download-installer.cdn.mozilla.net/pub/firefox/releases/$FIREFOX_VERSION/linux-x86_64/en-US/firefox-$FIREFOX_VERSION.tar.bz2 \
&amp;amp;&amp;amp; apt-get -y purge firefox \
&amp;amp;&amp;amp; rm -rf /opt/firefox \
&amp;amp;&amp;amp; tar -C /opt -xjf /tmp/firefox.tar.bz2 \
&amp;amp;&amp;amp; rm /tmp/firefox.tar.bz2 \
&amp;amp;&amp;amp; mv /opt/firefox /opt/firefox-$FIREFOX_VERSION \
&amp;amp;&amp;amp; ln -fs /opt/firefox-$FIREFOX_VERSION/firefox /usr/bin/firefox
# Install GeckoDriver
ARG GECKODRIVER_VERSION=0.31.0
RUN wget --no-verbose -O /tmp/geckodriver.tar.gz https://github.com/mozilla/geckodriver/releases/download/v$GECKODRIVER_VERSION/geckodriver-v$GECKODRIVER_VERSION-linux64.tar.gz \
&amp;amp;&amp;amp; rm -rf /opt/geckodriver \
&amp;amp;&amp;amp; tar -C /opt -zxf /tmp/geckodriver.tar.gz \
&amp;amp;&amp;amp; rm /tmp/geckodriver.tar.gz \
&amp;amp;&amp;amp; mv /opt/geckodriver /opt/geckodriver-$GECKODRIVER_VERSION \
&amp;amp;&amp;amp; chmod 755 /opt/geckodriver-$GECKODRIVER_VERSION \
&amp;amp;&amp;amp; ln -fs /opt/geckodriver-$GECKODRIVER_VERSION /usr/bin/geckodriver
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;You can refer to this &lt;a href="https://github.com/sunim2022/Jenkins_Docker/blob/9b55a490d3d83590a3eed3b064d73397a42d9de1/selenium-in-docker/Dockerfile"&gt;Dockerfile &lt;/a&gt;for more details.&lt;br&gt;
I created one sample/simple Google-search &lt;a href="https://github.com/sunim2022/Jenkins_Docker/tree/main/selenium-in-docker"&gt;project &lt;/a&gt;to test my final Dockerfile.&lt;br&gt;
Created the image successfully (after 22 attempts) :).&lt;/p&gt;

&lt;p&gt;&lt;code&gt;docker build -t seleniumtests-in-docker:1.0 .&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--mOHICLIe--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/lwlj4183zwg9o6q98lkj.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--mOHICLIe--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/lwlj4183zwg9o6q98lkj.png" alt="Docker build logs" width="880" height="394"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Time to create (my favorite) container.&lt;br&gt;
&lt;code&gt;docker run - rm - env "env_browser_param=Chrome" seleniumtests-in-docker:1.0&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;I am using environment variable "env_browser_param" to select between Chrome, Edge and Firefox browsers.&lt;/p&gt;

&lt;p&gt;Finally, was excited to see the "Build Success" message from inside the container.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--3LXwGapb--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/cbdaxuo4ry36xarzvf8h.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--3LXwGapb--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/cbdaxuo4ry36xarzvf8h.png" alt="Selenium tests status" width="880" height="210"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;I am sure the image size can be reduced, may be for next time.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--Bgy2q0Yh--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/o1o85h82ez074lik4isa.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--Bgy2q0Yh--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/o1o85h82ez074lik4isa.png" alt="Docker image" width="880" height="88"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Now I can launch multiple containers to test my app in multiple browsers. To test with a specific browser version, just change the corresponding ARG(s) in the Dockerfile, create a new image and start the container.&lt;br&gt;
After learning so much about docker and its use cases, I now understand how application developers can use Docker to simplify product deployments.&lt;/p&gt;




&lt;p&gt;I appreciate you taking time to read my "First" post.&lt;br&gt;
Next: &lt;em&gt;Docker adventure continues…&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;This blog was previously published on &lt;a href="https://medium.com/@suni.mothadikala/run-your-selenium-tests-inside-docker-container-part-1-9dfab15d1c86"&gt;medium&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;em&gt;&lt;strong&gt;&lt;a href="https://dev.to/sunim2022/run-your-selenium-tests-inside-docker-container-in-jenkins-part-2-2iek"&gt;Run your Selenium tests inside docker container (inside Jenkins container) - DIND, Part 2 …..&lt;/a&gt;&lt;/strong&gt;&lt;/em&gt;&lt;/p&gt;

</description>
      <category>selenium</category>
      <category>docker</category>
      <category>java</category>
      <category>seleniumwebdriver</category>
    </item>
  </channel>
</rss>
