title: Docker, JavaEE can't connect to my application in docker container
body: <p>Guys, I am starting  to learn Docker and I need to include it in my JavaEE application.</p>
  <p>I have one problem: container is running, but when I am trying to connect it from browser, I get 404 error : <code>The origin server did not find a current representation for the target resource or is not willing to disclose that one exists.  </code></p>
  <p>What i did:</p>
  <p>1.Created Dockerfile:</p>
  <pre><code>FROM tomcat
  
  COPY target/javaee_rest_jdbc_todo_list.war /usr/local/tomcat/webapps/
  </code></pre>
  <p>2.Created docker-compose:</p>
  <pre><code>version: &quot;3.7&quot;
  services:
    api_service:
      image: &quot;task_api&quot;
      hostname: task_service
      restart: always
      ports:
        - &quot;8080:8080&quot;
      depends_on:
        - mysql_db
    mysql_db:
      image: &quot;mysql:8.0&quot;
      hostname: mysql_db
      restart: always
      ports:
        - &quot;3308:3306&quot;
      environment:
        MYSQL_DATABASE: javaee_task_db
        MYSQL_USER: user228
        MYSQL_PASSWORD: user228
        MYSQL_ROOT_PASSWORD: 13574637480326
  </code></pre>
  <p>3.Changed in my application db URL 'localhost' on 'mysql_db':</p>
  <pre><code>    final static String URL = &quot;jdbc:mysql://mysql_db:3306/javaee_task_db?useSSL=false&quot;;
  
  &lt;plugin&gt;
            &lt;groupId&gt;com.googlecode.flyway&lt;/groupId&gt;
            &lt;artifactId&gt;flyway-maven-plugin&lt;/artifactId&gt;
            &lt;version&gt;1.5&lt;/version&gt;
            &lt;configuration&gt;
              &lt;user&gt;user228&lt;/user&gt;
              &lt;password&gt;user228&lt;/password&gt;
              &lt;driver&gt;com.mysql.jdbc.Driver&lt;/driver&gt;
              &lt;url&gt;jdbc:mysql://mysql_db:3306/javaee_task_db?autoReconnect=true&amp;amp;useUnicode=true&amp;amp;characterEncoding=UTF-8&amp;amp;connectionCollation=utf8_general_ci&amp;amp;characterSetResults=UTF-8&lt;/url&gt;
            &lt;/configuration&gt;
  &lt;/plugin&gt;
  </code></pre>
  <p>4.Runned command to build a war file <code>mvn clean package</code>.</p>
  <p>5.Runned command <code>docker build -t task_api . </code> to build an image.</p>
  <p>6.Runned command <code>docker-compose up -d</code>.</p>
  <p>All containers are runned, but I can't get ant information from browser, only get 404.
  You can download project from github:  <a href="https://github.com/MatveyAndrosyukk/javaee_rest_jdbc_todo_list" rel="nofollow noreferrer">https://github.com/MatveyAndrosyukk/javaee_rest_jdbc_todo_list</a> .</p>
  <p>Who faced Docker in JavaEE APP, help me please, I will be very grateful!</p>