Wiki source code of Build and Run a Custom XWiki Docker Image
Last modified by superadmin on 2026/11/25 21:33
Show last authors
| author | version | line-number | content |
|---|---|---|---|
| 1 | 1. Install [[Git>>https://git-scm.com/]]. | ||
| 2 | 1. Run the following command to clone the repository:((( | ||
| 3 | {{code language="bash"}} | ||
| 4 | git clone https://github.com/xwiki/xwiki-docker.git | ||
| 5 | {{/code}} | ||
| 6 | ))) | ||
| 7 | 1. Go to the ##xwiki-docker## directory created by the clone. | ||
| 8 | 1. Choose the directory matching your setup:((( | ||
| 9 | {{code language="bash"}} | ||
| 10 | cd <cycle_version>/mysql-tomcat | ||
| 11 | {{/code}} | ||
| 12 | |||
| 13 | For example, ##18/mysql-tomcat## for the latest released XWiki version of the 18.x cycle running on Tomcat and for MySQL, or ##18/postgres-tomcat## for XWiki 18.x + PostgreSQL. | ||
| 14 | ))) | ||
| 15 | 1. Modify the ##Dockerfile## in that directory as you wish.((( | ||
| 16 | {{info}} | ||
| 17 | To build a different XWiki version, change both ##XWIKI_VERSION## and ##XWIKI_DOWNLOAD_SHA256## in the ##Dockerfile##. The ##XWIKI_VERSION## entry of the ##.env## file does not affect the build~: it only selects which published image Docker Compose pulls. | ||
| 18 | {{/info}} | ||
| 19 | ))) | ||
| 20 | 1. Build the image, giving it a tag of your own:((( | ||
| 21 | {{code language="bash"}} | ||
| 22 | docker build -t my-xwiki . | ||
| 23 | {{/code}} | ||
| 24 | |||
| 25 | {{warning}} | ||
| 26 | Use your own tag rather than an official one such as ##xwiki:18.5.0-mysql-tomcat##, otherwise your local build shadows the published image of the same name. | ||
| 27 | {{/warning}} | ||
| 28 | ))) | ||
| 29 | 1. In ##docker-compose.yml##, point the ##web## service at your build by replacing its image value:((( | ||
| 30 | {{code language="yaml"}} | ||
| 31 | image: "my-xwiki" | ||
| 32 | {{/code}} | ||
| 33 | ))) | ||
| 34 | 1. Start the containers: {{code language="bash"}}docker compose up{{/code}}. | ||
| 35 | 1. Access XWiki: open your browser and go to {{code language="none"}}http://localhost:8080/{{/code}} once XWiki is started. |