1

I developed a Java EE application on Eclipse for a school project and try to use it in localhost through Tomcat, all using Docker. My problem is the url, I would like that when I launch my application with Docker, I can access it at http://localhost:8080. Currently, I have to go to the link http://localhost:8080/Epitech_Dashboard/.

Would it be possible to have access to the application directly on http://localhost:8080?

Ps: I saw a similar question on slack but it does not solve my problem because she does not handle the problem with docker-compose.

Here's my Dockerfile and my docker-compose.yml

Dockerfile:

FROM java:8
EXPOSE 8080
ADD /#.war #.war
ENTRYPOINT ["java", "-jar", "#.war"]

docker-compose.yml

version: '2'

services:
  web:
    image: tomcat:7
    environment:
      JDBC_URL: jdbc:mysql://db:3306/example_db?connectTimeout=0&socketTimeout=0&autoReconnect=true
      JDBC_USER: example_db_user
      JDBC_PASS: example_db_pass
    ports:
    - '8080:8080'
    volumes:
      - ./Epitech_Dashboard.war:/usr/local/tomcat/webapps/Epitech_Dashboard.war
    links:
      - db

  db:
    image: mysql:latest
    hostname: db
    environment:
      MYSQL_ROOT_PASSWORD: nimda
      MYSQL_DATABASE: example_db
      MYSQL_USER: example_db_user
      MYSQL_PASSWORD: example_db_pass
    volumes:
    - ./db:/docker-entrypoint-initdb.d

Thank you in advance.

Lab
  • 1,237
  • 2
  • 13
  • 30
  • 1
    Possible duplicate of [Deploying my application at the root in Tomcat](https://stackoverflow.com/questions/5328518/deploying-my-application-at-the-root-in-tomcat) – KevinO Nov 16 '18 at 15:16

0 Answers0