Wiki source code of Configure Tomcat for XWiki in Docker
Last modified by superadmin on 2026/11/25 21:30
Show last authors
| author | version | line-number | content |
|---|---|---|---|
| 1 | 1. Make sure you already have XWiki running using the official Docker image (see [[XWiki in Docker>>doc:documentation.xs.admin.installation.methods.install-xwiki-docker.xwiki-docker.WebHome]]), including the database container and the [[Docker network>>https://docs.docker.com/engine/network/]]. | ||
| 2 | 1. Create a temporary container from the XWiki image.((( | ||
| 3 | {{code language="bash"}} | ||
| 4 | docker create --name xwiki xwiki:stable-mysql-tomcat | ||
| 5 | {{/code}} | ||
| 6 | ))) | ||
| 7 | 1. Copy the default Tomcat configuration to the host machine, to start with some existing configuration files.((( | ||
| 8 | {{code language="bash"}} | ||
| 9 | docker cp xwiki:/usr/local/tomcat/conf /tmp/tomcat | ||
| 10 | {{/code}} | ||
| 11 | ))) | ||
| 12 | 1. Modify the configuration files in the copied ##/tmp/tomcat## directory to bring the changes you need. | ||
| 13 | 1. Remove the temporary container since it was only used to copy the configuration files and we'll need to create a new one with different parameters.((( | ||
| 14 | {{code language="bash"}} | ||
| 15 | docker rm xwiki | ||
| 16 | {{/code}} | ||
| 17 | ))) | ||
| 18 | 1. Start XWiki with the customized Tomcat configuration mounted into the container.((( | ||
| 19 | {{code language="bash"}} | ||
| 20 | docker run --net=xwiki-nw --name xwiki -p 8080:8080 \ | ||
| 21 | -v /tmp/xwiki:/usr/local/xwiki \ | ||
| 22 | -v /tmp/tomcat:/usr/local/tomcat/conf \ | ||
| 23 | -e DB_USER=xwiki \ | ||
| 24 | -e DB_PASSWORD=xwiki \ | ||
| 25 | -e DB_DATABASE=xwiki \ | ||
| 26 | -e DB_HOST=mysql-xwiki \ | ||
| 27 | xwiki:stable-mysql-tomcat | ||
| 28 | {{/code}} | ||
| 29 | |||
| 30 | Replace ##xwiki-nw## with the name of your Docker network, ##xwiki:stable-mysql-tomcat## with the [[tag you want>>https://hub.docker.com/_/xwiki/]], and the [[environment variables>>doc:documentation.xs.admin.installation.methods.install-xwiki-docker.configuration.environment-variables.WebHome]] with the values matching your environment. | ||
| 31 | ))) | ||
| 32 | 1. Open your wiki in a browser. XWiki restarts with the mounted configuration, and the Tomcat settings you changed in ##/tmp/tomcat## are now in effect. |