Dieseled UP
Dieseled UP

Reputation: 142

Tomcat docker-compose running web app

Was wondering if any one has attempted at running tomcat using docker-compose and successfully run a web app. I have put together the following docker-compose file.

tomcat:
   image: bitnami/tomcat:latest
   environment:
      - TOMCAT_USERNAME=root
      - TOMCAT_PASSWORD=password
   links:
     - db:mysql
   ports:
     - 8585:8080
   volumes:
     - ./tomcat:/bitnami/tomcat
db:
   image: mariadb
   ports:
      - 3636:3306
   environment:
   MYSQL_ROOT_PASSWORD: password
phpmyadmin:
   image: phpmyadmin/phpmyadmin
   links:
      - db:mysql
   ports:
      - 8689:80
   environment:
      MYSQL_USERNAME: root
      MYSQL_ROOT_PASSWORD: password
      PMA_HOST: mysql

The containers all run and I can access the apache 'web application manager' where I have deployed my .war file which shows to be running.

enter image description here

But when I try access it from the browser I am getting a 404

enter image description here

If anyone could help or point me in the right direction it would be greatly appreciated.

Sorry should of pointed out I am using Thyme-leaf for web templating so the index.html file is in the resources/templates folder and I have my Controller mapping to it. And I also had this problem before I starting using Thyme-leaf. Everything is working on a local environment just not in the container.

Upvotes: 2

Views: 9916

Answers (2)

Dieseled UP
Dieseled UP

Reputation: 142

OK guys finally figured this out issue was to do with the tomcat dependency I had in my pom

<dependency>
    <groupId>org.springframework.boot</groupId>
    <artifactId>spring-boot-starter-tomcat</artifactId>
    <scope>provided</scope>
</dependency>

Even though the scope is set to provided the container does not seem to like it, I have removed the dependency and everything is working as expected.

enter image description here

Upvotes: 3

Gman
Gman

Reputation: 2453

your new_test.war is missing the index.html file, if you say its in there check its in the correct location root folder. use 7zip or similar tool to open your war/archive to see where the file is located.

Upvotes: 0

Related Questions