title: error while loading shared libraries: libnss3.so: cannot open shared object file: No such file or directory using Selenium Gitlab pipeline with docker
body: <p>docker-compose yml</p>
  <pre><code>version: &quot;3&quot;
  services:
    chrome:
      image: selenium/node-chrome:4.1.3-20220327
      shm_size: 2gb
      depends_on:
        - selenium-hub
      environment:
        - SE_EVENT_BUS_HOST=selenium-hub
        - SE_EVENT_BUS_PUBLISH_PORT=4442
        - SE_EVENT_BUS_SUBSCRIBE_PORT=4443
  
    edge:
      image: selenium/node-edge:4.1.3-20220327
      shm_size: 2gb
      depends_on:
        - selenium-hub
      environment:
        - SE_EVENT_BUS_HOST=selenium-hub
        - SE_EVENT_BUS_PUBLISH_PORT=4442
        - SE_EVENT_BUS_SUBSCRIBE_PORT=4443
  
    firefox:
      image: selenium/node-firefox:4.1.3-20220327
      shm_size: 2gb
      depends_on:
        - selenium-hub
      environment:
        - SE_EVENT_BUS_HOST=selenium-hub
        - SE_EVENT_BUS_PUBLISH_PORT=4442
        - SE_EVENT_BUS_SUBSCRIBE_PORT=4443
  
    selenium-hub:
      image: selenium/hub:4.1.3-20220327
      container_name: selenium-hub
      ports:
        - &quot;4442:4442&quot;
        - &quot;4443:4443&quot;
        - &quot;4444:4444&quot;
  </code></pre>
  <p>gitlab yml file</p>
  <pre><code>variables:
    MAVEN_OPTS: -Dmaven.repo.local=.m2/repository
  
  .base:
    except:
      - tags
  
  .base_test:
    extends: .base
    tags:
      - docker-in-docker
    image: docker/compose:latest
    services:
      - name: docker:dind
    before_script:
      - docker-compose up
  
  stages:
    - build
    - test
    
  cache:
    paths:
      - .m2/repository
      - target
  
  build:
    image: maven:latest
    stage: build
    script:
      - mvn clean
    tags:
      - docker-in-docker
      
  test:
    image: maven:latest
    stage: test
    script:
      - mvn test
    tags:
      - docker-in-docker
    artifacts:
      paths:
        - ./TestReport/*
      expire_in: 7 days
      
  </code></pre>
  <p>Remote url in test script</p>
  <pre><code>ChromeOptions options = new ChromeOptions();
              options.setCapability(&quot;se:recordVideo&quot;, true);
              driver = new RemoteWebDriver((new URL(&quot;http://docker:4444/wd/hub&quot;)), options);
  </code></pre>
  <p>Pipeline error when executing the stage : test</p>
  <pre><code>/root/.cache/selenium/chromedriver/linux64/100.0.4896.60/chromedriver: error while loading shared libraries: libnss3.so: cannot open shared object file: No such file or directory
  selectTemplateTest2 started!
  selectTemplateTest2 skipped!
  Extent Reports Version 3  Test Suite is ending!
  [ERROR] Tests run: 3, Failures: 2, Errors: 0, Skipped: 1, Time elapsed: 1.7 s &lt;&lt;&lt; FAILURE! - in TestSuite
  [ERROR] init(templateTest.TemplateSelectorTest2)  Time elapsed: 1.473 s  &lt;&lt;&lt; FAILURE!
  org.openqa.selenium.SessionNotCreatedException: Could not start a new session. Possible causes are invalid address of the remote server or browser start-up failure.
  Caused by: org.openqa.selenium.WebDriverException: 
  Driver server process died prematurely.
  Build info: version: '4.1.1', revision: 'e8fcc2cecf'
  System info: host: 'runner-5ahk-ct-project-4846-concurrent-0', ip: '172.18.0.12', os.name: 'Linux', os.arch: 'amd64', os.version: '5.4.0-105-generic', java.version: '17.0.2'
  Driver info: driver.version: ChromeDriver
  [ERROR] tearDown(templateTest.TemplateSelectorTest2)  Time elapsed: 0.006 s  &lt;&lt;&lt; FAILURE!
  java.lang.NullPointerException: Cannot invoke &quot;org.openqa.selenium.WebDriver.quit()&quot; because &quot;this.driver&quot; is null
  [INFO] 
  [INFO] Results:
  [INFO] 
  [ERROR] Failures: 
  [ERROR]   TemplateSelectorTest2&gt;WorkspaceAppTestBase.init:43-&gt;TestBase.initialize:42 » SessionNotCreated
  [ERROR]   TemplateSelectorTest2&gt;WorkspaceAppTestBase.tearDown:57-&gt;TestBase.browserTearDown:57 » NullPointer
  </code></pre>
  <p>Can someone please help me fix this Gitlab pipeline issue?</p>
  <p>I have set Gitlab pipeline to run selenium tests with grid setup  using docker-compose yml file but it seems remoteWebdriver url  connection is not working with  grid setup</p>
  <p>Locally it works fine when i have docker running , docker compose up and then run the testng xml file</p>
  <p>Solution:</p>
  <p>Update
  gitlab yml file</p>
  <pre><code>variables:
  MAVEN_OPTS: -Dmaven.repo.local=.m2/repository
  
  stages:
  - build
  - test
  
  cache:
  paths:
    - .m2/repository
    - target
  
  build:
  image: docker/compose:latest
  stage: build
  services:
    - name: docker:dind
  script:
    - docker-compose up -d
  tags:
    - docker-in-docker
    
  test:
  image: maven:latest
  stage: test
  script: 
    - mvn test
  tags:
    - docker-in-docker
  artifacts:
    paths:
      - ./TestReport/*
    expire_in: 7 days
    
  </code></pre>
  <p>Then for cannot create new session error, i had to provide reference to oreganization specific remote url in browser initialization file</p>