Multiple Services in Container localhost communication

I have a Docker container (derived from official Tomcat image) that is running Tomcat with two REST APIs, an Apache server for Django app, and PostgreSQL database.

(I know that best practices suggest running these as separate containers, but I wanted to package the whole system as one container for usability by non-devs).

One of my REST API calls the other REST API through the endpoint http://localhost:8080/rest2/insert . However, I keep getting a org.apache.http.conn.HttpHostConnectException: Connection to refused error.

I have tried hardcoding the container ip but I still get a Connection Refused error.

I assume this will be a problem for the localhost PostgreSQL connection from rest1 as well. What are my options?

Any help is much appreciated!