oblador / loki

👁 Visual Regression Testing for Storybook
https://loki.js.org/
MIT License
1.77k stars 172 forks source link

yarn loki-test-ci chrome.docker throwing error invalid IP address in add-host: "host-gateway". #431

Open indrasenakatam opened 1 year ago

indrasenakatam commented 1 year ago

we are using storybook and loki for visual regression testing using gitLab pipelines. We are using below command before the test command.

but we are getting below error. loki test v0.31.0 RUNS chrome.docker RUNS chrome.docker/PREPARE PASS chrome.docker/PREPARE RUNS chrome.docker/START

FAIL chrome.docker/START: Command failed with exit code 125: docker run --rm -d -P --security-opt=seccomp=/builds/*/node_modules/@loki/target-chrome-docker/src/docker-seccomp.json --add-host=host.docker.internal:host-gateway -v /builds//storybook-static:/var/loki --shm-size=1g -p 42977:42977 yukinying/chrome-headless-browser:90.0.4408.0 --disable-datasaver-prompt --no-first-run --disable-extensions --remote-debugging-address=0.0.0.0 --remote-debugging-port=42977 --headless --disable-gpu --hide-scrollbars --no-sandbox

docker: Error response from daemon: invalid IP address in add-host: "host-gateway". See 'docker run --help'. FAIL chrome.docker: Some tasks failed to run

this issue coming with new version v0.31.0

indrasenakatam commented 1 year ago

for --chromeDockerImage='yukinying/chrome-headless-browser:90.0.4408.0'. --add-host=host.docker.internal:host-gateway

We are getting below error FAIL chrome.docker/START: Command failed with exit code 125: docker run --rm -d -P --security-opt=seccomp=/@loki/target-chrome-docker/src/docker-seccomp.json --add-host=host.docker.internal:host-gateway -v /storybook-static:/var/loki --shm-size=1g -p 37345:37345 yukinying/chrome-headless-browser:90.0.4408.0 --disable-datasaver-prompt --no-first-run --disable-extensions --remote-debugging-address=0.0.0.0 --remote-debugging-port=37345 --headless --disable-gpu --hide-scrollbars --no-sandbox

docker: Error response from daemon: invalid IP address in add-host: "host-gateway".

how to override or update above --add-host flags.

And time yarn add loki@0.30.3. is working fine with same code base and latest version loki@0.31.0. throwing error.

SO , could you please help on this how to resolve this issue.

@oblador it would be appreciate your help on this. Thank you in advance

indrasenakatam commented 1 year ago

Can any one please suggest on this how to resolve this issue. Thank you very much in advance.

CC: @oblador

volodymyr-bezhenar commented 1 year ago

@indrasenakatam What version of docker do you use? We had similar issue, upgrade of docker solved this (you need at least v20.10.23).

JuanmaMenendez commented 1 year ago

hi @volodymyr-bezhenar thanks for answering, I am having the same issue. Can you please put a code example of where did you updated your docker version docker? thanks

volodymyr-bezhenar commented 1 year ago

Hi @JuanmaMenendez, fix is not in the code. We have upgraded docker deamon used on Jenkins workers. I.e. administrators have to upgrade docker in our CI. More details you can find in original PR thread: https://github.com/moby/moby/pull/40007 and https://github.com/docker/cli/issues/2664

JuanmaMenendez commented 1 year ago

The solution for me were:

A) For the error: "FAIL chrome.docker/FETCH_STORIES: Using unsafe HTTP verb GET to invoke /json/new. This action supports only PUT verb"

Solution: removing from my vrt script call: the params: "--host host.docker.internal --chromeDockerImage yukinying/chrome-headless-browser-stable"

Ending up with something like: "vrt:test": "loki test --port 6000 --reference vrt/images/reference --output vrt/images/current --difference vrt/images/difference || true",

B) Then for the error: "docker: Error response from daemon: invalid IP address in add-host: "host-gateway""

Solution: Downgrading loki to version 0.30.3