Docker protractor run ends with E/launcher – Process exited with error code 135

Running of protractor tests in docker ends with error code:135

  1. I’m packing Angular application with protractor e2e tests to a docker container with help of Docker file
  2. I’m running docker-compose contains running of selenium grid containers(hub and chrome)
  3. I’m trying to execute protractor conf file command in order to run e2e tests. (seleniumAddress: ‘http://172.18.0.2:4444/wd/hub/‘)

Notes:

First I tried to run tests inside of the container with localhost, but than realized it contains another host inside of the container. But it hasn’t resolved the problem even when I’ve changed the host.

Also, I tried do not run grid containers, but using “webdriver-manager update” and “webdriver-manager start” commands. Starting works fine, but the same problem happens during tests start.

Also, i’ve volumed application and selenium grid to my local machine and both can be opened in browser. Only one thing, if I’m trying to connect locally to http://localhost:4444/wd/hub/ it shows me the following exception:

“sessionId”: null,
“status”: 13,
“value”: {
“class”: “org.openqa.grid.common.exception.GridException”,
“error”: “unknown error”,
“message”: “Session [(null externalkey)] not available and is not among the last 1000 terminated sessions.nActive sessions are[]”,

version: "3"
services:
  hub:
    container_name: hub
    image: selenium/hub:3.141.59
    privileged: true
    ports: 
      - 4444:4444
    environment:
      - GRID_BROWSER_TIMEOUT=240000
      - GRID_TIMEOUT=240000
  chrome:
    container_name: node-chrome
    image: selenium/node-chrome:3.141.59
    privileged: true
    shm_size: 256M
    depends_on:
      - hub
    environment:
      - HUB_HOST=hub
      - no_proxy=localhost
      - HUB_PORT_4444_TCP_ADDR=hub
      - HUB_PORT_4444_TCP_PORT=4444
  testapp:
    container_name: testapp
    build: .
    image: dneprokos/testapp
    ports:               
      - "4200:4200"
    depends_on:             
      - chrome
      - hub
FROM node:12.8.1-alpine as build-step
WORKDIR /app
COPY package.json ./
RUN npm install
RUN npm install -g [email protected]
RUN apk add openjdk8
ENV PATH $PATH:/usr/lib/jvm/java-1.8-openjdk/bin
COPY . .
EXPOSE 4200 4444
CMD npm start
baseUrl: 'http://localhost:4200/',
  seleniumAddress: 'http://172.18.0.2:4444/wd/hub/',
docker container exec -it testapp sh

Expected Result: Test running should be started
Actual Result:

[17:44:34] E/launcher – Error code: 135
[17:44:34] E/launcher – Error message: ECONNREFUSED connect ECONNREFUSED 172.18.0.2:4444
[17:44:34] E/launcher – Error: ECONNREFUSED connect ECONNREFUSED 172.18.0.2:4444
at ClientRequest. (/usr/local/lib/node_modules/protractor/node_modules/selenium-webdriver/http/index.js:238:15)
at ClientRequest.emit (events.js:203:13)
at Socket.socketErrorListener (_http_client.js:399:9)
at Socket.emit (events.js:203:13)
at emitErrorNT (internal/streams/destroy.js:91:8)
at emitErrorAndCloseNT (internal/streams/destroy.js:59:3)
at processTicksAndRejections (internal/process/task_queues.js:77:11)
From: Task: WebDriver.createSession()
at Function.createSession (/usr/local/lib/node_modules/protractor/node_modules/selenium-webdriver/lib/webdriver.js:769:24)

Source: StackOverflow