title: Docker Compose Tomcat Can not connect to postgresql
body: <p>I have 2 containers. One of them postgresql, one of them tomcat.
  I tried to start applications but always getting o.h.e.jdbc.spi.SqlExceptionHelper - Connection refused. Check that the hostname and port are correct and that the postmaster is accepting TCP/IP connections. error. Please help me i don't have much time.
  Best regards.</p>
  
  <p>I tried different type of docker composes. But i got always same error.</p>
  
  <pre><code>16:48:09.557 [localhost-startStop-1] ERROR o.h.e.jdbc.spi.SqlExceptionHelper - Connection refused. Check that the hostname and port are correct and that the postmaster is accepting TCP/IP connections.
  </code></pre>
  
  <p>My connection url</p>
  
  <pre><code>db.user=admin
  db.password=123456
  db.url=jdbc:postgresql://moneytransferdb:5410/moneytransfer
  </code></pre>
  
  <p>My docker compose yml</p>
  
  <pre><code>version: '3'
  
  services:
    moneytransferdb:
     image: postgres
     restart: always
     ports:
       - "5410:5432"
     volumes:
       - mydatavol:/var/lib/postgresql/data
     environment:
       POSTGRES_USER: admin
       POSTGRES_PASSWORD: 123456
       POSTGRES_DB: moneytransfer
     container_name: moneytransfer
     networks:
       - main
    tomcat:
      image: tomcat
      ports:
       - "8080:8080"
      volumes:
       - ../tcmb/tcmb-service.war:/usr/local/tomcat/webapps/tcmb.war
      container_name: tcmb
      depends_on:
       - moneytransferdb
      links:
       - moneytransferdb
      restart: always
      networks:
       - main
  volumes:
    mydatavol: {}
  networks:
    main:
  </code></pre>