-
Hello. I’m working on a Ruby on Rails project where we use GitHub actions as a CI. While adding browser tests, I face issue accessing our app from within a service container. Here is the part of workflow file that performs browser tests:
Notice the These steps launch a container with Firefox, which should open our app accessible on the runner machine port 4000. But it didn’t happen: Firefox throws an error saying “http://localhost:4000 is not reachable”. Could you please tell me are the runner machine ports blocked, or I should use some different hostname. |
Beta Was this translation helpful? Give feedback.
Replies: 3 comments
-
And here is the RSpec output:
|
Beta Was this translation helpful? Give feedback.
-
Hi @arg, Glad to see you in Github Community Forum! The services are running backend and your workflow steps are executed on hosted runner directly. Your env is a job level setting, is it correct? If you’d like to access runner within service container, the env should have same level with services: image, ports. And you only opened 4444 port from on the host and service container, not port 4000. Regarding access the host ip from docker container, please check the link here if it helps. Typically the usage is access services from host, please check the sample code here for your reference. Thanks. |
Beta Was this translation helpful? Give feedback.
-
I managed to fix the issue by using a proper runner machine IP instead of Here is the step I added into workflow:
Then I can point browser to Thanks @weide-zhou for the hint. |
Beta Was this translation helpful? Give feedback.
I managed to fix the issue by using a proper runner machine IP instead of
localhost
.Here is the step I added into workflow:
Then I can point browser to
http://${{APP_IP}}:4000
.Thanks @weide-zhou for the hint.