Dockerfile links8, 8.4, 8.4.4, 8-mysql-tomcat, mysql-tomcat, lts-mysql-tomcat, lts-mysql, lts, latest (8/mysql-tomcat/Dockerfile)9, 9.0, 9-mysql-tomcat, stable-mysql-tomcat, stable-mysql, stable (9/mysql-tomcat/Dockerfile)8-postgres-tomcat, 8.4-postgres-tomcat, 8.4.4-postgres-tomcat, postgres-tomcat, lts-postgres-tomcat, lts-postgres (8/postgres-tomcat/Dockerfile)9-postgres-tomcat, 9.1-postgres-tomcat, stable-postgres-tomcat, stable-postgres (9/postgres-tomcat/Dockerfile)For more information about this image and its history, please see the relevant manifest file (library/xwiki). This image is updated via pull requests to the docker-library/official-images GitHub repo.
For detailed information about the virtual/transfer sizes and individual layers of each of the above supported tags, please see the repos/xwiki/tag-details.md file in the docker-library/repo-info GitHub repo.
XWiki is a free wiki software platform written in Java with a design emphasis on extensibility. XWiki is an enterprise wiki. It includes WYSIWYG editing, OpenDocument based document import/export, semantic annotations and tagging, and advanced permissions management.
As an application wiki, XWiki allows for the storing of structured data and the execution of server side script within the wiki interface. Scripting languages including Velocity, Groovy, Python, Ruby and PHP can be written directly into wiki pages using wiki macros. User-created data structures can be defined in wiki documents and instances of those structures can be attached to wiki documents, stored in a database, and queried using either Hibernate query language or XWiki's own query language.
XWiki.org's extension wiki is home to XWiki extensions ranging from code snippets which can be pasted into wiki pages to loadable core modules. Many of XWiki Enterprise's features are provided by extensions which are bundled with it.
The goal is to provide a production-ready XWiki system running in Docker. This is why:
You should first install Docker on your machine.
Then there are several options:
You need to run 2 containers:
Start by creating a dedicated docker network:
docker network create -d bridge xwiki-nw
Then run a container for the database and make sure it's configured to use an UTF8 encoding. The following databases are supported out of the box:
The command below will also configure the MySQL container to save its data on your localhost in a /my/own/mysql directory:
docker run --net=xwiki-nw --name mysql-xwiki -v /my/own/mysql:/var/lib/mysql -e MYSQL_ROOT_PASSWORD=xwiki -e MYSQL_USER=xwiki -e MYSQL_PASSWORD=xwiki -e MYSQL_DATABASE=xwiki -d mysql:5.7 --character-set-server=utf8 --collation-server=utf8_bin --explicit-defaults-for-timestamp=1
You should adapt the command line to use the passwords that you wish for the MySQL root password and for the xwiki user password.
The command below will also configure the PostgreSQL container to save its data on your localhost in a /my/own/postgres directory:
docker run --net=xwiki-nw --name postgres-xwiki -v /my/own/postgres:/var/lib/postgresql/data -e POSTGRES_ROOT_PASSWORD=xwiki -e POSTGRES_USER=xwiki -e POSTGRES_PASSWORD=xwiki -e POSTGRES_DB=xwiki -e POSTGRES_INITDB_ARGS="--encoding=UTF8" -d postgres:9.5
You should adapt the command line to use the passwords that you wish for the PostgreSQL root password and for the xwiki user password.
Then run XWiki in another container by issuing one of the following command.
For MySQL:
docker run --net=xwiki-nw --name xwiki -p 8080:8080 -v /my/own/xwiki:/usr/local/xwiki -e DB_USER=xwiki -e DB_PASSWORD=xwiki -e DB_DATABASE=xwiki -e DB_HOST=mysql-xwiki xwiki:mysql-tomcat
For PostgreSQL:
docker run --net=xwiki-nw --name xwiki -p 8080:8080 -v /my/own/xwiki:/usr/local/xwiki -e DB_USER=xwiki -e DB_PASSWORD=xwiki -e DB_DATABASE=xwiki -e DB_HOST=postgres-xwiki xwiki:postgres-tomcat
Be careful to use the same DB username, password and database names that you've used on the first command to start the DB container. Also, please don't forget to add a -e DB_HOST= environment variable with the name of the previously created DB container so that XWiki knows where its database is.
At this point, XWiki should start in interactive blocking mode, allowing you to see logs in the console. Should you wish to run it in "detached mode", just add a "-d" flag in the previous command.
docker run -d --net=xwiki-nw ...
Another solution is to use the Docker Compose files we provide.
wget https://raw.githubusercontent.com/xwiki-contrib/docker-xwiki/master/8/mysql-tomcat/mysql/xwiki.cnf: This will download the MySQL configuration (UTF8, etc)
wget or prefer to use curl: curl -fSL https://raw.githubusercontent.com/xwiki-contrib/docker-xwiki/master/8/mysql-tomcat/mysql/xwiki.cnf -o xwiki.cnfwget -O docker-compose.yml https://raw.githubusercontent.com/xwiki-contrib/docker-xwiki/master/docker-compose-mysql.yml
wget or prefer to use curl: curl -fSL https://raw.githubusercontent.com/xwiki-contrib/docker-xwiki/master/docker-compose-mysql.yml -o docker-compose.ymldocker-compose upFor reference here's a minimal Docker Compose file using MySQL that you could use as an example (full example here):
version: '2'
networks:
bridge:
driver: bridge
services:
web:
image: "xwiki:mysql-tomcat"
container_name: xwiki-mysql-tomcat-web
depends_on:
- db
ports:
- "8080:8080"
environment:
- DB_USER=xwiki
- DB_PASSWORD=xwiki
- DB_HOST=xwiki-mysql-db
volumes:
- xwiki-data:/usr/local/xwiki
networks:
- bridge
db:
image: "mysql:5.7"
container_name: xwiki-mysql-db
volumes:
- ./xwiki.cnf:/etc/mysql/conf.d/xwiki.cnf
- mysql-data:/var/lib/mysql
environment:
- MYSQL_ROOT_PASSWORD=xwiki
- MYSQL_USER=xwiki
- MYSQL_PASSWORD=xwiki
- MYSQL_DATABASE=xwiki
networks:
- bridge
volumes:
mysql-data: {}
xwiki-data: {}
wget -O docker-compose.yml https://raw.githubusercontent.com/xwiki-contrib/docker-xwiki/master/docker-compose-postgres.yml
wget or prefer to use curl: curl -fSL https://raw.githubusercontent.com/xwiki-contrib/docker-xwiki/master/docker-compose-postgres.yml -o docker-compose.ymldocker-compose upFor reference here's a minimal Docker Compose file using PostgreSQL that you could use as an example (full example here):
version: '2'
networks:
bridge:
driver: bridge
services:
web:
image: "xwiki:postgres-tomcat"
container_name: xwiki-postgres-tomcat-web
depends_on:
- db
ports:
- "8080:8080"
environment:
- DB_USER=xwiki
- DB_PASSWORD=xwiki
- DB_HOST=xwiki-postgres-db
volumes:
- xwiki-data:/usr/local/xwiki
networks:
- bridge
db:
image: "postgres:9.5"
container_name: xwiki-postgres-db
volumes:
- postgres-data:/var/lib/postgresql/data
environment:
- POSTGRES_ROOT_PASSWORD=xwiki
- POSTGRES_PASSWORD=xwiki
- POSTGRES_USER=xwiki
- POSTGRES_DB=xwiki
- POSTGRES_INITDB_ARGS="--encoding=UTF8"
networks:
- bridge
volumes:
postgres-data: {}
xwiki-data: {}
This allows you to rebuild the XWiki docker image locally. Here are the steps:
git clone https://github.com/xwiki-contrib/docker-xwiki.git or download the sources from the GitHub UI. Then go to the directory corresponding to the docker tag you wish to use. For example: cd 8/mysql-tomcat
8/mysql-tomcat directory will get you the latest released XWiki version of the 8.x cycle running on Tomcat and for MySQL.8/postgres-tomcat directory will get you the latest released XWiki version of the 8.x cycle running on Tomcat and for MySQL.9/mysql-tomcat directory will get you the latest released XWiki version of the 9.x cycle running on Tomcat and for MySQL.docker-compose uphttp://localhost:8080Note that if you want to set a custom version of XWiki you can edit the .env file and set the values you need in there. It's also possible to override them on the command line with docker-compose run -e "XWIKI_VERSION=8.4.4".
Note that docker-compose up will automatically build the XWiki image on the first run. If you need to rebuild it you can issue docker-compose up --build. You can also build the image with docker build . -t xwiki-mysql-tomcat:latest for example.
The first time you create a container out of the xwiki image, a shell script (/usr/local/bin/docker-entrypoint.sh) is executed in the container to setup some configuration. The following environment variables can be passed:
DB_USER: The user name used by XWiki to read/write to the DB.DB_PASSWORD: The user password used by XWiki to read/write to the DB.DB_DATABASE: The name of the XWiki database to use/create.DB_HOST: The name of the host (or docker container) containing the database. Default is "db".It's possible to pass JVM options to Tomcat by defining the JAVA_OPTS environment property.
For example to debug XWiki, you could use:
docker run --net=xwiki-nw --name xwiki -p 8080:8080 -v xwiki:/usr/local/xwiki -e DB_USER=xwiki -e DB_PASSWORD=xwiki -e DB_DATABASE=xwiki -e DB_HOST=mysql-xwiki -e JAVA_OPTS="-Xdebug -Xnoagent -Djava.compiler=NONE -Xrunjdwp:transport=dt_socket,server=y,suspend=y,address=5005" -p 5005:5005 xwiki
Notice the mapping of the port with p 5005:5005 which expose the port and thus allows you to debug XWiki from within your IDE for example.
Volumes:
If you don't map any volume when using docker run or if you use docker-compose then Docker will create some internal volumes attached to your containers as follows.
<prefix>_mysql-data or <prefix>_postgres-data that contains the database data.<prefix>_xwiki-data that contains XWiki's permanent directory.To find out where those volumes are located on your local host machine you can inspect them with docker volume inspect <volume name>. To find the volume name, you can list all volumes with docker volume ls.
Note that on Mac OSX, Docker runs inside the xhyve VM and thus the paths you get when inspecting the volumes are relative to this. Thus, you need to get into that VM if you need to access the volume data.
MySQL:
docker psdocker exec -it <containerid> bash -lmysql command: mysql --user=xwiki --password=xwikiXWiki is licensed under the LGPL 2.1.
The Dockerfile repository is also licensed under the LGPL 2.1.
This image is officially supported on Docker version 17.03.1-ce.
Support for older versions (down to 1.6) is provided on a best-effort basis.
Please see the Docker installation documentation for details on how to upgrade your Docker daemon.
Documentation for this image is stored in the xwiki/ directory of the docker-library/docs GitHub repo. Be sure to familiarize yourself with the repository's README.md file before attempting a pull request.