IP address of service

I have two services running on my device, one is a gstreamer pipeline sending video to the other service, which is a media gateway. I am running in bridge network mode so the services can talk and the ports are open to each other, however, the gstreamer pipeline needs to know the IP address of the gateway. How can I get access to this explicit IP address?

Thank you!

Not sure I fully understand the question. Seeing the docker-compose files may help to be able to provide some broad stroke suggestions.

General thoughts that may be helpful, two containers on the same network (i.e. such as when started with the same docker-compose file) can communicate to each other using their container names (i.e. http://my-containername:8080). In these instances you don’t need to expose a port in your compose file, as they are on the same network.

If you are trying to reach out of the network and back in to an exposed port you could use 172.17.0.1. Although you shouldn’t need to as they can talk to each other.

Based on my understanding of what you are asking (getting the IP of the other container), you can use it’s container name as a hostname.

You can test it out by going into a container (balena exec -it your-container-name sh) and then ‘ping myothercontainer’.

This is perfect, thank you. I was able to use the container name in my bash script that starts the gstreamer pipeline and it works beautifully.

1 Like