title: Chrome not reachable inside docker network
body: <p>I have a web app which I am trying to test under Gitlab-CI using Protractor.</p>
  
  <p>I am using docker-in-docker in Gitlab-CI to build and test the application.</p>
  
  <p>I have all my services containerized in Docker (a Nginx server to host static files, a Nodejs API, a Postgresql DB and a Nginx reverse proxy, "pointing" to the static files nginx server and the nodejs API).</p>
  
  <p>Yesterday, when running the Protractor tests everything was ok.
  Then, I have merged my git branch with another to add new tests.
  In the middle of the merge process, I lost my reverse nginx proxy configuration (I've deleted it by mistake), which I had to remade. I do not think that the new reverse-proxy configuration is the problem, but at the same time, this is the only thing that has changed.
  Every test is failing now with the error:</p>
  
  <pre><code>WebDriverError: chrome not reachable
  e2e_1_511616c9d3bd  |       (Session info: headless chrome=68.0.3440.106)
  e2e_1_511616c9d3bd  |       (Driver info: chromedriver=2.38 (05121428cd0fc129e40a3694cf5405698236ad14),platform=Linux 4.14.48-coreos-r2 x86_64)
  e2e_1_511616c9d3bd  |         at Object.checkLegacyResponse (/usr/lib/node_modules/protractor/node_modules/selenium-webdriver/lib/error.js:546:15)
  e2e_1_511616c9d3bd  |         at parseHttpResponse (/usr/lib/node_modules/protractor/node_modules/selenium-webdriver/lib/http.js:509:13)
  e2e_1_511616c9d3bd  |         at doSend.then.response (/usr/lib/node_modules/protractor/node_modules/selenium-webdriver/lib/http.js:441:30)
  e2e_1_511616c9d3bd  |         at process._tickCallback (internal/process/next_tick.js:68:7)
  e2e_1_511616c9d3bd  |     From: Task: Protractor.get(https://reverseproxy.xyz/) - get url
  ...
  </code></pre>
  
  <p>I can see in my gitlab-ci console that when the tests start the browser makes some successful requests to the nodejs API.</p>
  
  <p>My nginx reverse proxy configuration:</p>
  
  <pre><code>worker_processes  auto;
  
  events {
      worker_connections  1024;
  }
  
  http {
  
      upstream docker-web {
          server web:4200;
      }
  
      upstream docker-api {
          server api:8443;
      }
  
      proxy_redirect      off;
      proxy_set_header    Host        $host;
      proxy_set_header    X-Real-IP   $remote_addr;
      proxy_ssl_session_reuse off;
  
      server {
  
          server_name localhost;
  
          location / {
              proxy_pass https://docker-web;
          }
  
          location /api/ {
              proxy_pass https://docker-api/;
          }
          listen 443 ssl;
          listen [::]:443 ssl ipv6only=on;
          ssl_certificate /etc/nginx/proxy.crt;
          ssl_certificate_key /etc/nginx/proxy.key;
          ssl_session_cache shared:le_nginx_SSL:1m;
          ssl_session_timeout 1440m;
  
          ssl_protocols TLSv1 TLSv1.1 TLSv1.2;
          ssl_prefer_server_ciphers on;
  
          ssl_ciphers "ECDHE-ECDSA-CHACHA20-POLY1305:ECDHE-RSA-CHACHA20-POLY1305:ECDHE-ECDSA-AES128-GCM-SHA256:ECDHE-RSA-AES128-GCM-SHA256:ECDHE-ECDSA-AES256-GCM-SHA384:ECDHE-RSA-AES256-GCM-SHA384:DHE-RSA-AES128-GCM-SHA256:DHE-RSA-AES256-GCM-SHA384:ECDHE-ECDSA-AES128-SHA256:ECDHE-RSA-AES128-SHA256:ECDHE-ECDSA-AES128-SHA:ECDHE-RSA-AES256-SHA384:ECDHE-RSA-AES128-SHA:ECDHE-ECDSA-AES256-SHA384:ECDHE-ECDSA-AES256-SHA:ECDHE-RSA-AES256-SHA:DHE-RSA-AES128-SHA256:DHE-RSA-AES128-SHA:DHE-RSA-AES256-SHA256:DHE-RSA-AES256-SHA:ECDHE-ECDSA-DES-CBC3-SHA:ECDHE-RSA-DES-CBC3-SHA:EDH-RSA-DES-CBC3-SHA:AES128-GCM-SHA256:AES256-GCM-SHA384:AES128-SHA256:AES256-SHA256:AES128-SHA:AES256-SHA:DES-CBC3-SHA:!DSS";
      }
  }
  </code></pre>
  
  <p>My tests are running under an alpine container, with the following Dockerfile:</p>
  
  <pre><code>FROM alpine:latest
  
  RUN sed -i -e 's/v[[:digit:]]\.[[:digit:]]/edge/g' /etc/apk/repositories
  RUN apk upgrade --update-cache --available
  
  RUN apk add npm
  RUN npm install -g protractor
  
  # chromium dependencies
  RUN apk add openjdk8-jre-base
  RUN apk add nss
  RUN apk add chromium
  RUN apk add chromium-chromedriver
  RUN apk upgrade --no-cache --available
  ENV CHROME_BIN /usr/bin/chromium-browser
  
  RUN mkdir /e2e
  COPY . /e2e
  CMD protractor /e2e/ci-conf.js
  </code></pre>
  
  <p>This is my ci-conf.js</p>
  
  <pre><code>exports.config = {
    framework: 'jasmine',
    chromeOnly: true,
    directConnect: true,
    specs: ['src/e2e-spec.js'],
    chromeDriver: '/usr/bin/chrome',
    baseUrl: 'https://reverseproxy.xyz', // reverseproxy.xyz is the name of my reverse proxy docker-compose service
    capabilities: {
      browserName: 'chrome',
      acceptInsecureCerts: true, // I'm currently using self-signed certificates in the reverse-proxy
      chromeOptions: {
        args: ['headless','no-sandbox', 'disable-gpu', '--window-size=1920,1080']
      }
    }
  }
  </code></pre>
  
  <p>My docker-compose, which I use to initialize the app and start the tests:</p>
  
  <pre><code>version: '3.7'
  
  services:
    reverseproxy.xyz:
      image: registry.gitlab.com/projectname/reverseproxy:latest
      depends_on:
        - web
      ports:
        - 443:443
    web:
      image: registry.gitlab.com/projectname/web:42-ci
      depends_on:
        - api
    db:
      image: registry.gitlab.com/projectname/db:42-ci
      volumes:
        - postgres:/var/lib/postgresql/data
    api:
      image: registry.gitlab.com/projectname/api:42-ci
      depends_on:
        - db
    e2e:
      image: e2e:latest
      depends_on:
        - reverseproxy.xyz
  volumes:
    postgres:
  </code></pre>
  
  <p>My gitlab-ci testing stage:</p>
  
  <pre><code>web_integration_tests:
    stage: test
    script:
      - docker-compose pull
      - docker-compose up -d db
      - docker-compose up -d api
      - docker-compose up -d web
      - docker-compose up -d reverseproxy.xyz
      - sleep 5
      - docker-compose up --exit-code-from 
  </code></pre>
  
  <p>An example of a test that I'm trying to run inside e2e-spec.js:</p>
  
  <pre><code>describe('Be logged in', function() {
    let showAddAccounts = element(by.id('accountIconList'));
    let fbLoginBtn = element(by.id('fbLoginBtn'));
  
    beforeEach(function() {
      browser.get('');
    });
  
    it('Should Login in facebook', function() {
      browser.sleep(500);
      showAddAccounts.click();
      fbLoginBtn.isPresent().then((isPresent) =&gt; {
        if (isPresent) { // does not appear if already logged in
          fbLoginBtn.click().then( () =&gt; {
            browser.waitForAngularEnabled(false);
            browser.getCurrentUrl().then(url =&gt; {
              browser.driver.findElement(by.id('email')).sendKeys(test_email);
              browser.driver.findElement(by.id('pass')).sendKeys(test_pass);
              browser.driver.findElement(by.id('loginbutton')).click();
              browser.waitForAngularEnabled(true);
            });
          })
        }
      });
      expect(browser.getCurrentUrl()).toContain(`manage-accounts`);
    });
  });
  </code></pre>
  
  <p>This exactly same test was running well 1 day ago.</p>
  
  <p>I have searched this issue a lot, and almost all solutions point to downgrade chrome or chromedriver. But, as my tests were running yesterday with exactly the same versions of chrome and chromedriver, I do not think that this is the issue. </p>
  
  <p>I have also tried to use another docker image, to run the tests, based on node10-stretch with chrome v70.0.3538.67 and chromedriver v2.43.600233, and had the same error.</p>
  
  <p>When I run these tests in my Win10 machine without using docker, all the tests get green.</p>
  
  <p>Any help would be much appreciated.</p>