Access port of one container from another container

I have a postgres database in one container, and a java application in another container. Postgres database is accessible from port 1310 in localhost, but the java container is not able to access it.
I tried this command:

docker run modelpolisher_java java -jar ModelPolisher-noDB-1.7.jar --host=biggdb --port=5432 --user=postgres --passwd=postgres --dbname=bigg

But it gives error biggdb.

Here is my docker-compose.yml file:

version: '3'
    container_name: modelpolisher_biggdb
    build: ./docker/bigg_docker
      - POSTGRES_USER=postgres
      - POSTGRES_PASSWORD=postgres
      - POSTGRES_DB=bigg
      - "1310:5432"
    container_name: modelpolisher_java
    build: ./docker/java_docker
    stdin_open: true
    tty: true

Dockerfile for biggdb:

FROM postgres:11.4

RUN apt update &&
apt install wget -y &&
# Create directory '/bigg_database_dump/' and download bigg_database dump as 'database.dump'
wget -P /bigg_database_dump/ &&
rm -rf /var/lib/apt/lists/*

COPY ./scripts/ /docker-entrypoint-initdb.d/

EXPOSE 1310:5432

Can somebody please tell what changes I need to do in the docker-compose.yml, or in the command, to make java container access ports of biggdb (postgres) container?

Source: StackOverflow