Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

dial tcp 127.0.0.1:5432: connect: connection refused #199

Closed
ifeelingz opened this issue Apr 14, 2022 · 9 comments
Closed

dial tcp 127.0.0.1:5432: connect: connection refused #199

ifeelingz opened this issue Apr 14, 2022 · 9 comments

Comments

@ifeelingz
Copy link

ifeelingz commented Apr 14, 2022

image

dial tcp 127.0.0.1:5432: connect: connection refused

"docker-github-actions-runner" works great. But I got a problem when I simulate the Database and it can't connect.

Meanwhile, if I install it on Ubuntu without Docker, it works fine.

How should I fix this? Can recommend me ?

Best Regards.

@ifeelingz ifeelingz reopened this Apr 14, 2022
@ifeelingz
Copy link
Author

Just., Fixed IP !!

image

@makarov-roman
Copy link

makarov-roman commented Aug 3, 2022

Hey @ifeelingz, can you elaborate a little bit more? As far I understand you starting new postgres container inside gh-runner, but then you trying to access it via public IP of machine, on which docker with runner works?
Do you have only one runner per machine?

@makarov-roman
Copy link

makarov-roman commented Aug 3, 2022

it works for me too. But it's more like workaround than solution. Every job with such database service has to be exposed on host machine, which makes it much harder to scale (both vertically and horizontally).

@myoung34 should we reopen the issue?

@myoung34
Copy link
Owner

myoung34 commented Aug 3, 2022

To be honest I still dont understand the issue but this is more configuration than anything else. the runner has nothing to do with the networking configuration and is different per orchestrator. For all I know the issue here is solely related to docker-compose

@nmalaguti
Copy link
Contributor

It looks like the solution was to expose the port on the docker host interface? I'm pretty sure 172.17.0.1 is usually the gateway IP in the default bridge network. Since the runner is on the same bridge network as the service containers, you're able to access them this way. If you're running multiple jobs concurrently you'll almost certainly run into port conflicts.

@myoung34
Copy link
Owner

myoung34 commented Aug 3, 2022

172.17.0.1 is indeed the docker gateway for the service itself to talk to the host.

IE if you run something on 8888 on 0.0.0.0 you can hit it from a container on 172.17.0.1:8888 in most common docker set up scenarios

This behavior is very specific to docker itself and not other CRI's

@makarov-roman
Copy link

Thanks for your feedback. Although I understand that it's not specific to this repo, some lost souls like me who had workflows on self-hosted runner without docker and now have this issue would be greatly appreciate it if you could point in the right direction.

@jsoneaday
Copy link

Has anyone got this to work without using the 172 ip. I tried that ip and it still getting connection refused. Although I am not using a service for a docker compose up command

@myoung34
Copy link
Owner

If youre using docker 4 windows or mac it could be different, but it will be whatever the gateway is

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants