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

Connection refused on localhost - only with Docker #104

Open
1 of 2 tasks
Guttz opened this issue May 30, 2019 · 10 comments
Open
1 of 2 tasks

Connection refused on localhost - only with Docker #104

Guttz opened this issue May 30, 2019 · 10 comments
Labels
good first issue Good for newcomers

Comments

@Guttz
Copy link
Contributor

Guttz commented May 30, 2019

I'm submitting a

  • 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:

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

@Guttz
Copy link
Contributor Author

Guttz commented May 30, 2019

The error message received seems to be somehow related to docker not being able to connect to Redis(but not sure)

@xadahiya
Copy link
Member

Which OS are you using?

@Guttz
Copy link
Contributor Author

Guttz commented May 30, 2019

I'm on ubuntu 18.04

@shravandoda
Copy link
Contributor

shravandoda commented May 30, 2019

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

@Guttz
Copy link
Contributor Author

Guttz commented May 30, 2019

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.

@Mec-iS
Copy link
Contributor

Mec-iS commented May 30, 2019

@Guttz can we put this configuration bit in docker-compose or in a bash script?

@Guttz
Copy link
Contributor Author

Guttz commented May 30, 2019

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.

@Mec-iS
Copy link
Contributor

Mec-iS commented Jun 3, 2019

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

@Mec-iS Mec-iS added the good first issue Good for newcomers label Jun 3, 2019
@Guttz
Copy link
Contributor Author

Guttz commented Jun 4, 2019

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: moby/libnetwork#2348

Guttz added a commit that referenced this issue Jun 4, 2019
Observation linking to temp solution for #104
@Blakelist7
Copy link

Hi, @Guttz I am new to the community, could you help me getting this issue resolved. Also new to open source :)

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

No branches or pull requests

5 participants