Chrome not reachable inside docker network










2















I have a web app which I am trying to test under Gitlab-CI using Protractor.



I am using docker-in-docker in Gitlab-CI to build and test the application.



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).



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:



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
...


I can see in my gitlab-ci console that when the tests start the browser makes some successful requests to the nodejs API.



My nginx reverse proxy configuration:



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";




My tests are running under an alpine container, with the following Dockerfile:



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


This is my ci-conf.js



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']





My docker-compose, which I use to initialize the app and start the tests:



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:


My gitlab-ci testing stage:



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


An example of a test that I'm trying to run inside e2e-spec.js:



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) =>
if (isPresent) // does not appear if already logged in
fbLoginBtn.click().then( () =>
browser.waitForAngularEnabled(false);
browser.getCurrentUrl().then(url =>
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`);
);
);


This exactly same test was running well 1 day ago.



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.



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.



When I run these tests in my Win10 machine without using docker, all the tests get green.



Any help would be much appreciated.










share|improve this question






















  • I think you're passing arguments to your browser incorrectly. In your config try to use this args: ["--no-sandbox", "--window-size=1920,1080", "--headless", "--disable-gpu"]

    – Sergey Pleshakov
    Nov 16 '18 at 14:20











  • @SergeyPleshakov, I've already tried that before.

    – Renato Campos
    Nov 16 '18 at 15:00















2















I have a web app which I am trying to test under Gitlab-CI using Protractor.



I am using docker-in-docker in Gitlab-CI to build and test the application.



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).



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:



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
...


I can see in my gitlab-ci console that when the tests start the browser makes some successful requests to the nodejs API.



My nginx reverse proxy configuration:



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";




My tests are running under an alpine container, with the following Dockerfile:



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


This is my ci-conf.js



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']





My docker-compose, which I use to initialize the app and start the tests:



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:


My gitlab-ci testing stage:



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


An example of a test that I'm trying to run inside e2e-spec.js:



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) =>
if (isPresent) // does not appear if already logged in
fbLoginBtn.click().then( () =>
browser.waitForAngularEnabled(false);
browser.getCurrentUrl().then(url =>
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`);
);
);


This exactly same test was running well 1 day ago.



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.



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.



When I run these tests in my Win10 machine without using docker, all the tests get green.



Any help would be much appreciated.










share|improve this question






















  • I think you're passing arguments to your browser incorrectly. In your config try to use this args: ["--no-sandbox", "--window-size=1920,1080", "--headless", "--disable-gpu"]

    – Sergey Pleshakov
    Nov 16 '18 at 14:20











  • @SergeyPleshakov, I've already tried that before.

    – Renato Campos
    Nov 16 '18 at 15:00













2












2








2


1






I have a web app which I am trying to test under Gitlab-CI using Protractor.



I am using docker-in-docker in Gitlab-CI to build and test the application.



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).



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:



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
...


I can see in my gitlab-ci console that when the tests start the browser makes some successful requests to the nodejs API.



My nginx reverse proxy configuration:



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";




My tests are running under an alpine container, with the following Dockerfile:



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


This is my ci-conf.js



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']





My docker-compose, which I use to initialize the app and start the tests:



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:


My gitlab-ci testing stage:



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


An example of a test that I'm trying to run inside e2e-spec.js:



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) =>
if (isPresent) // does not appear if already logged in
fbLoginBtn.click().then( () =>
browser.waitForAngularEnabled(false);
browser.getCurrentUrl().then(url =>
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`);
);
);


This exactly same test was running well 1 day ago.



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.



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.



When I run these tests in my Win10 machine without using docker, all the tests get green.



Any help would be much appreciated.










share|improve this question














I have a web app which I am trying to test under Gitlab-CI using Protractor.



I am using docker-in-docker in Gitlab-CI to build and test the application.



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).



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:



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
...


I can see in my gitlab-ci console that when the tests start the browser makes some successful requests to the nodejs API.



My nginx reverse proxy configuration:



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";




My tests are running under an alpine container, with the following Dockerfile:



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


This is my ci-conf.js



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']





My docker-compose, which I use to initialize the app and start the tests:



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:


My gitlab-ci testing stage:



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


An example of a test that I'm trying to run inside e2e-spec.js:



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) =>
if (isPresent) // does not appear if already logged in
fbLoginBtn.click().then( () =>
browser.waitForAngularEnabled(false);
browser.getCurrentUrl().then(url =>
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`);
);
);


This exactly same test was running well 1 day ago.



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.



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.



When I run these tests in my Win10 machine without using docker, all the tests get green.



Any help would be much appreciated.







google-chrome docker nginx protractor gitlab-ci






share|improve this question













share|improve this question











share|improve this question




share|improve this question










asked Nov 15 '18 at 19:13









Renato CamposRenato Campos

264




264












  • I think you're passing arguments to your browser incorrectly. In your config try to use this args: ["--no-sandbox", "--window-size=1920,1080", "--headless", "--disable-gpu"]

    – Sergey Pleshakov
    Nov 16 '18 at 14:20











  • @SergeyPleshakov, I've already tried that before.

    – Renato Campos
    Nov 16 '18 at 15:00

















  • I think you're passing arguments to your browser incorrectly. In your config try to use this args: ["--no-sandbox", "--window-size=1920,1080", "--headless", "--disable-gpu"]

    – Sergey Pleshakov
    Nov 16 '18 at 14:20











  • @SergeyPleshakov, I've already tried that before.

    – Renato Campos
    Nov 16 '18 at 15:00
















I think you're passing arguments to your browser incorrectly. In your config try to use this args: ["--no-sandbox", "--window-size=1920,1080", "--headless", "--disable-gpu"]

– Sergey Pleshakov
Nov 16 '18 at 14:20





I think you're passing arguments to your browser incorrectly. In your config try to use this args: ["--no-sandbox", "--window-size=1920,1080", "--headless", "--disable-gpu"]

– Sergey Pleshakov
Nov 16 '18 at 14:20













@SergeyPleshakov, I've already tried that before.

– Renato Campos
Nov 16 '18 at 15:00





@SergeyPleshakov, I've already tried that before.

– Renato Campos
Nov 16 '18 at 15:00












1 Answer
1






active

oldest

votes


















0














I found the solution.
I had to set the size of the /dev/shm partition to 2 gb in my docker-compose e2e service using the argument shm_size: '2gb'.






share|improve this answer























    Your Answer






    StackExchange.ifUsing("editor", function ()
    StackExchange.using("externalEditor", function ()
    StackExchange.using("snippets", function ()
    StackExchange.snippets.init();
    );
    );
    , "code-snippets");

    StackExchange.ready(function()
    var channelOptions =
    tags: "".split(" "),
    id: "1"
    ;
    initTagRenderer("".split(" "), "".split(" "), channelOptions);

    StackExchange.using("externalEditor", function()
    // Have to fire editor after snippets, if snippets enabled
    if (StackExchange.settings.snippets.snippetsEnabled)
    StackExchange.using("snippets", function()
    createEditor();
    );

    else
    createEditor();

    );

    function createEditor()
    StackExchange.prepareEditor(
    heartbeatType: 'answer',
    autoActivateHeartbeat: false,
    convertImagesToLinks: true,
    noModals: true,
    showLowRepImageUploadWarning: true,
    reputationToPostImages: 10,
    bindNavPrevention: true,
    postfix: "",
    imageUploader:
    brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
    contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
    allowUrls: true
    ,
    onDemand: true,
    discardSelector: ".discard-answer"
    ,immediatelyShowMarkdownHelp:true
    );



    );













    draft saved

    draft discarded


















    StackExchange.ready(
    function ()
    StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53326458%2fchrome-not-reachable-inside-docker-network%23new-answer', 'question_page');

    );

    Post as a guest















    Required, but never shown

























    1 Answer
    1






    active

    oldest

    votes








    1 Answer
    1






    active

    oldest

    votes









    active

    oldest

    votes






    active

    oldest

    votes









    0














    I found the solution.
    I had to set the size of the /dev/shm partition to 2 gb in my docker-compose e2e service using the argument shm_size: '2gb'.






    share|improve this answer



























      0














      I found the solution.
      I had to set the size of the /dev/shm partition to 2 gb in my docker-compose e2e service using the argument shm_size: '2gb'.






      share|improve this answer

























        0












        0








        0







        I found the solution.
        I had to set the size of the /dev/shm partition to 2 gb in my docker-compose e2e service using the argument shm_size: '2gb'.






        share|improve this answer













        I found the solution.
        I had to set the size of the /dev/shm partition to 2 gb in my docker-compose e2e service using the argument shm_size: '2gb'.







        share|improve this answer












        share|improve this answer



        share|improve this answer










        answered Nov 18 '18 at 20:06









        Renato CamposRenato Campos

        264




        264





























            draft saved

            draft discarded
















































            Thanks for contributing an answer to Stack Overflow!


            • Please be sure to answer the question. Provide details and share your research!

            But avoid


            • Asking for help, clarification, or responding to other answers.

            • Making statements based on opinion; back them up with references or personal experience.

            To learn more, see our tips on writing great answers.




            draft saved


            draft discarded














            StackExchange.ready(
            function ()
            StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53326458%2fchrome-not-reachable-inside-docker-network%23new-answer', 'question_page');

            );

            Post as a guest















            Required, but never shown





















































            Required, but never shown














            Required, but never shown












            Required, but never shown







            Required, but never shown

































            Required, but never shown














            Required, but never shown












            Required, but never shown







            Required, but never shown







            這個網誌中的熱門文章

            Barbados

            How to read a connectionString WITH PROVIDER in .NET Core?

            Node.js Script on GitHub Pages or Amazon S3