Networks in Docker, communicate two containers

Hey guys, I have been working with docker in a project and I’m currently stuck. My problem is the next.

Imagine two containers in the same network:

In the first one, I have running a Mosquitto broker (MQTT Broker) and the MQTTGateway that is a tool/service to export data from Mosquitto to Prometheus, this tool exposes metrics on port 9337.

In a second container, I have running Prometheus.

I need that my second container (Prometheus) connects to the port 9337 of the first one (MQTT Broker and MQTTGateway) in order to get all the data that came from the Mosquitto broker. I tried a lot of stuff but I can’t make it works.

Does someone know how to do it?

Thanks!