Unable to call a Service from Docker Container

Hello,

I have a docker container basically running Athena Tool Kit for PDF generation. The service in docker in turn calls a NodeJs Application at this URL: - http://localhost:3005.

Note: I am running docker and NodeJs Service on Windows 10.

However I see a message on Docker Console:-

[GIN] 2019/08/23 - 22:24:46 | 500 |    1.850464ms |    192.168.99.1 |  GET     /convert
Error #01: Get http://localhost:3005/presentations/d0161fed-0ade-40a5-8dff-26696e553e96?id=d0161fed-0ade-40a5-8dff-26696e553e96&type=box-upload&params=: dial tcp 127.0.0.1:3005: connect: connection refused
captured errors:
Error #01: Get http://localhost:3005/presentations/d0161fed-0ade-40a5-8dff-26696e553e96?id=d0161fed-0ade-40a5-8dff-26696e553e96&type=box-upload&params=: dial tcp 127.0.0.1:3005: connect: connection refused.

The Docker Service runs locally at http://192.168.99.100:8080. From this address it is trying to call 127.0.0.1:3005. When it does I get the error above.

I am guessing this must be allowing access to local host from a different IP.Please let me know what needs to be done?

My guess is docker is its own network, so it cannot connect to LocalHost:3005. To work around this issue I changed the network of the docker container to host. However, I have come to know that this feature is not supported in windows. So what do I do now ?

Below is the reference to the question I posted on Stack Overflow:-

For bridged and overlay networks, localhost is local to the container. If the process queriying localhost:3005 is inside the container then there is not problem.

if localhost:3005 is hard coded in a config file, you can introduce an env variable that holds the external url http://192.168.99.100:8080 and sets it on container start in the configuration file beeing responsible.This would at least allow to modify the hard coded address when the container is created. Though, a dynamic approach is prefered, where you get the information about the host and port from the request url itself.

If neither modifiying the configuration on container start or modifiying the app is an option, you might introduce a reverse proxy that rewrites the url.

I am not sure I understand you. You say Local Host is accessible from Docker. I see a message on the Docker Client Localhost connection refused. Why would I get this error if Localhost is accessible.

I am not sure I understood the explanation you gave about having variables. Can you give an example based on my explanation above.

This is not the same as localhost on your Docker host…

So how do I access Local Host on the Docker Host. I am running on Windows 10.

Please share the exact commands or your docker-compose.yml that includes everything you do, to get your container up and running.

Do you see the link in the original question. Its a stackoverflow link. Please take a look and let me know if you see something missing.

I assume you are not the maintainer of the image?

Yes I just downloaded the image.

I did run the container with docker run -d -p 8080:8080 -it patelsan/presentations-pdf-toolkit:1.0.1 and there is not one error in the logs. So it must be something caused by configuration or the way you use it!!

What does that mean? Did you configure something that the container calls 127.0.0.1:3005, or is this the default behavior of the image?

Update: it is not…

This thread is a classical case of: i just tell you what I think is important without providing the full picture.

Where did you find the documentation of this image?
What do you expect this image to do?
What makes you think this is image is not a work in progress state?
how do you expect that it needs to be configured?