Lightsail container communication

0

I currently have a Lightsail container service deployment with two containers. One container needs to make a server-side http call (a Python request) to the other container, which is running a REST api. This works fine locally with docker compose but the connection is refused in the Lightsail deployment.

The Lightsail docs here seems to indicate this is possible by using the private domain and the open port of the container. ie For container service foo, and a container within that service listening on port 6000, you should be able to access that container within the private domain at foo.service.local:6000. This is what I tried leading to the connection refused error.

But there is also a section here that says to open communications via environment variable. I don't quite understand this. Does anyone have examples of this?

Any help with either method to get communication between containers working would be appreciated.

Ryan
asked 8 months ago359 views
2 Answers
0

Hello.
Is it possible to communicate when accessing with "localhost:6000"?

profile picture
EXPERT
answered 8 months ago
0

The problem I had is actually with the service within the container (was unresponsive), not the inter-container communication. I sanity tested with a different viable service and was able to reach from one container to another using the private domain as stated in the documentation.

Just to be clear, for a deployment foo with two containers A and B, with container B listening on port 6000, A is able to make http requests to B using host foo.service.local:6000.

Ryan
answered 8 months ago

You are not logged in. Log in to post an answer.

A good answer clearly answers the question and provides constructive feedback and encourages professional growth in the question asker.

Guidelines for Answering Questions