How to change user config in docker tomcat 8?

2019-08-24 08:37发布

问题:

Using docker quick start terminal I have started a tomcat container and it is running and i can able to open the tomcat homepage. But i can't able to open the manager app by using default username:"admin" password:"admin". How can i update the config of tomcat??

回答1:

from the doc https://hub.docker.com/_/tomcat/: The configuration files are available in /usr/local/tomcat/conf/. By default, no user is included in the "manager-gui" role required to operate the "/manager/html" web application. If you wish to use this app, you must define such a user in tomcat-users.xml.

If you want, you can replace this folder from your host with a volume in your run (docker run [...] -v /your/conf/:/usr/local/tomcat/conf/ [...])



回答2:

In your catalina base directory you need to include something like:

<role rolename="manager"/>
<user username="admin" password="admin" roles="manager"/>

at file

"\CATALINA_BASE\conf\tomcat-users.xml"

For Manager Apps : GUI access

<role rolename="manager-gui"/>
<user username="admin" password="admin" roles="manager-gui"/>