Connection refused on localhost - only with Docker
I'm submitting a
- [x] bug report.
- [ ] feature request.
Current Behaviour:
When trying to connect to a localhost hydrus server using docker, the agent returns Connection refused as the image:

However, it works for http://35.224.198.158:8080/api. At the same time, running python querying_mechanism.py directly works perfectly for both remote and local server.
Expected Behaviour:
Running via docker should enable to connect to local hydrus servers.
Do you want to work on this issue?
Yes, but appreciate any suggestions since I'm not really sure the reason for it
The error message received seems to be somehow related to docker not being able to connect to Redis(but not sure)
Which OS are you using?
I'm on ubuntu 18.04
The error message received seems to be somehow related to docker not being able to connect to Redis(but not sure)
If that was the case, Docker wouldn't have connected to http://35.224.198.158:8080/api as well. The problem seems to be of docker not being able to detect localhost. Kindly take a look here https://stackoverflow.com/questions/24319662/from-inside-of-a-docker-container-how-do-i-connect-to-the-localhost-of-the-mach
Quick fix:
Linux:
sudo ip addr show docker0
Copy the default docker bridge link that is created, by default it's http://172.17.0.1
Windows/Mac: Use http://host.docker.internal instead of http://localhost
If you use Windows/Mac and can test this solution and give a thumbs up would be helpful so I can add in the docs. Also, seems like soon host.docker.internal should work in all OS.
Follow the post mentioned by @motormouthdoda for more answers.
@Guttz can we put this configuration bit in docker-compose or in a bash script?
I tried it for a while but didn't find something for all OS. I will install a VM to test some other compatibility matters with the agent and then I come back here and take a look again into this.
Quick fix: Linux: sudo ip addr show docker0
Copy the default docker bridge link that is created, by default it's http://172.17.0.1
Windows/Mac: Use http://host.docker.internal instead of http://localhost
If you use Windows/Mac and can test this solution and give a thumbs up would be helpful so I can add in the docs. Also, seems like soon host.docker.internal should work in all OS.
Follow the post mentioned by @motormouthdoda for more answers.
I suppose we can just add this part to a "Troubleshooting" section in the README
Yes, at least for now, I'll add this there while we can come up with a better solution.
There's a PR on docker which would make http://host.docker.internal a universal solution but it doesn't seem like a priority right now: https://github.com/docker/libnetwork/pull/2348
Hi, @Guttz I am new to the community, could you help me getting this issue resolved. Also new to open source :)