I am creating a gitlab-ci to run e2e tests over my application, so, given I have this docker-compose.yml:
services:
chrome:
image: zenika/alpine-chrome:latest
command: [
chromium-browser,
"--headless",
"--no-sandbox",
"--disable-gpu",
"--ignore-certificate-errors",
"--reduce-security-for-testing",
"--remote-debugging-address=0.0.0.0",
"--remote-debugging-port=9222",
"https://google.com/",
]
ports:
- "9222:9222"
networks:
- test-e2e
networks:
test-e2e:
ipam:
driver: default
config:
- subnet: 172.28.0.0/16
when I run docker-compose up everything just works fine,
and on my local machine I am able to visit localhost:9222 and access the chrome debugger.
However, when I run the same job on gitlab-ci I get a ECONNREFUSED error:
F---F
Failures:
1) Scenario: List of Profiles # src/features/profile.feature:3
✖ Before # dist/node/development/webpack:/hooks/puppeteer.hooks.ts:17
Failed to fetch browser webSocket url from http://localhost:9222/json/version: connect ECONNREFUSED 127.0.0.1:9222
Error: connect ECONNREFUSED 127.0.0.1:9222
at TCPConnectWrap.afterConnect [as oncomplete] (net.js:1191:14)
So it is clear that I cannot join the docker-compose network and access localhost:9222 from the job
My gitlab-ci.yml is pretty straightforward and looks like this:
E2E tests:
stage: test end-to-end
image:
name: docker/compose:1.24.1
entrypoint: ["/bin/sh", "-c"]
services:
- docker:dind
before_script:
- apk --update add nodejs yarn
- docker-compose -f test-e2e.yaml up -d
script:
- yarn test:cucumber
after_script:
- docker-compose -f test-e2e.yaml down
yarn test:cucumber basically runs cucumber and puppeteer trying to access localhost:9222 to get chrome's metadata.
How can I join the network created by docker-compose from the gitlab-ci job?
- I don't have access to edit runner configurations