Issue
I am starting a Docker container with Chrome inside, as follows:
docker run --rm --cap-add=SYS_ADMIN --network=host selenoid/vnc:chrome_117.0
In my local machine, this container listens to incoming requests in the following URL: http://localhost:4444/
Nevertheless, I have a "connection refused" error when trying to connect that URL (http://localhost:4444/) after starting that image (using the host network) in GitHub Actions. The error I get in Java is the following:
Caused by: java.net.ConnectException: Connection refused (Connection refused)
Can I use the host network in GitHub Actions?
Solution
I confirmed this can be done in GH Actions. The problem I experienced was the use of Xvfb. For some reason, using Xvfb does not allow us to use port 4444 in the same session.
It is solved as follows:
- Test: https://github.com/bonigarcia/selenium-examples/blob/main/src/test/java/io/github/bonigarcia/selenium/remote/DockerWdmChromeCdpTest.java
- Workflow: https://github.com/bonigarcia/selenium-examples/blob/main/.github/workflows/docker-java.yml
- Execution: https://github.com/bonigarcia/selenium-examples/actions/runs/6706576135
Answered By - Boni García
0 comments:
Post a Comment
Note: Only a member of this blog may post a comment.