I'm running a RPC server in a docker container, say on port 8080. I map this port to 8545 in my host machine. So I can now send RPC requests to the server on my host machine by sending it to localhost:8545, this works all fine.
I now have another docker container, where the container is supposed to constantly send requests to the server (you can imagine something like requests.send("http://localhost:8545", .....) ). It's actually sending to port 8545 of the container though, not to port 8545 of the host, and I couldn't find a way to connect them. From what I understand, things like docker compose usually maps the port of the container to the host, but still figuring how to maps the port of the host to the container.
Wondering if anyone has any insights on this?