title: JDBC connection error only while starting docker-compose
body: <p>Why when I am running docker-compose with the file below, and I am trying to run <code>localhost:8080/todo-application-1.0/</code> I am getting internal error within is mentioned that jdbc cannot connect. But when I am running the same docker-compose file without <code>web</code> service I am able to connect to the database, can anyone explain to me what is wrong? How to successfully create a docker-compose or dockerfile that will copy the .war with the application and run it without any issues with the connection.</p>
  
  <pre><code>version: '3.3'
  
  services:
    database:
      image: mysql:8.0
      restart: always
      environment:
        MYSQL_DATABASE: 'todo-app'
        MYSQL_USER: 'admin'
        MYSQL_PASSWORD: 'admin'
        MYSQL_ROOT_PASSWORD: 'admin'
      ports:
        - '3306:3306'
      expose:
        - '3306'
    web:
      image: tomcat
      ports:
        - "8080:8080"
      volumes:
        - ./build/libs/todo-application-1.0.war:/usr/local/tomcat/webapps/todo-application-1.0.war
  
  </code></pre>