Michał Krzywański
Michał Krzywański

Reputation: 16910

Cannot access tomcat manager or any other default tomcat app when running tomcat in docker

I am trying to access tomcat manager app from host. The port publishing is successfull but when trying to access tomcat manager I get 404 error.

This is the command used to launch the tomcat :

docker container run -p 8010:8080 --name mytomcat tomcat:9.0

and trying to access it by url :

http://localhost:8010/manager

From the logs I can confirm that tomcat is running, and I can access it from host system, but when accessing the manager app, 404 is received.

Upvotes: 3

Views: 3347

Answers (1)

Michał Krzywański
Michał Krzywański

Reputation: 16910

It turns out that all default tomcat apps have been removed from the webapps directory for all tomcat images starting with Tomcat version 7. All apps have been moved to /usr/local/tomcat/webapps.dist directory so that they are not launched by default. You can read about it here.

If you still want to access those default apps you can copy them back to the webapps directory, if you wish:

FROM tomcat:9.0
RUN mv /usr/local/tomcat/webapps.dist/* /usr/local/tomcat/webapps/
CMD ["catalina.sh","run"]

or copy only the apps that you want. Also you will have to edit tomcat configuration files to not get 403 when accessing those apps.

Upvotes: 4

Related Questions