Private connection between two containers not working
[Also posted in the forums, but for better visibility also posting here]
Hey, maybe this is trivial, but I am quite new to the world of deployment and that kind of stuff and can't seem to figure out what the problem could be.
I have two services (containers) running. One container (c1) is hosting a Django web application on port 8001. The other service (c2) is running on port 8000 and has some endpoint v1/endpoint up and running.
I now want to request this endpoint from within my first container (c1) over the private network adress.
I have tried to use both the long and the short form of the specified adress displayed under the settings from c2. (service_name.railway.internal|service_name)
So in full length the URL I am trying to reach from c1 is https://service_name:8000/v1/endpoint, which is not working.
Originally, I tested it locally, where I had two Docker containers running. There, I also encountered the issue that they could not connect, but I could fix it by establishing a network between them and then also simply calling the second container by its name and the exposed port.
Am I missing something here/do I need to do something additionally such that c1 can reach c2?
Hope anyone can help me out here by giving me a hint! π
Best regards,
Marius
8 Replies
Project ID:
N/A
N/A
Make sure you're using
http
and not https
Yea, I actually had
http
before. Did not change anything sadly.that's strange π€
If I generate a public domain
service_name-production.up.railway.app
and use that for my request through Postman https://service_name-production.up.railway.app/v1/endpoint
I can normally reach that endpoint and get the results - but I need it to be a private point and not reachable by the public ...closing out in favor of the help station post.
New reply sent from Help Station thread:
For anyone stumbling over this thread in the future: I simply had to change from IPv4 to IPv6 on my service that is listening (0.0.0.0 -> :: ) and then I could reach it from my other services.You're seeing this because this thread has been automatically linked to the Help Station thread.