This page (revision-32) was last changed on 03-Dec-2021 18:30 by Klaus Thevessen 

This page was created on 08-Mar-2015 14:17 by unknown

Only authorized users are allowed to rename pages.

Only authorized users are allowed to delete pages.

Version Date Modified Size Author Changes ... Change note
32 03-Dec-2021 18:30 12 KB Klaus Thevessen to previous
31 28-Nov-2021 13:12 11 KB Klaus Thevessen to previous | to last apache/jspwiki must in the first line.
30 11-Sep-2021 15:05 11 KB Juan Pablo to previous | to last Fix docker hub image link
29 11-Sep-2021 13:01 11 KB Juan Pablo to previous | to last Added section on ENV variables
28 11-Sep-2021 12:01 11 KB Juan Pablo to previous | to last Examples use apache/jspwiki docker image
27 11-Jan-2021 21:44 11 KB Juan Pablo to previous | to last fix unwanted line-wrapping
26 03-Jan-2021 15:19 11 KB Carl Marcum to previous | to last fixed non-printable characters causing unwanted line-wrapping
25 03-Jan-2021 15:18 11 KB Carl Marcum to previous | to last fixed non-printable characters causing unwanted line-wrapping
24 01-Jan-2021 20:58 11 KB Carl Marcum to previous | to last fixed unintential line breaks in run example explaination
23 01-Jan-2021 19:39 11 KB Juan Pablo to previous | to last fix typo
22 01-Jan-2021 19:31 11 KB Juan Pablo to previous | to last add proposed changes from ML
21 09-Jan-2017 18:15 10 KB Harry Metske to previous | to last
Incoming links Outgoing links

Difference between version and

At line 1 changed one line
!!! Docker for JSPWiki
!!! JSPWiki for Docker
At line 3 changed one line
After some experiments with [Docker|https://docs.docker.com] I came up with a working solution for running JSPWiki in Tomcat on Linux in a Docker container.
JSPWiki can be used with [Docker|https://docs.docker.com]. Docker images can be built from source or you can use a pre-built official image.
At line 7 added one line
!! Default Image
At line 8 changed one line
!!! What container is it ?
The default JSPWiki Docker image uses the official Docker Community supported [Apache Tomcat 9 image|https://github.com/docker-library/tomcat/blob/b9416beec5364c00694595d6f3c61b09e764113c/9.0/jdk11/openjdk-buster/Dockerfile] which is based on the [OpenJDK 11|https://github.com/docker-library/openjdk/blob/20450f7a60b8db7aafd491a5ea55c6a3548138c6/11/jdk/buster/Dockerfile] built on Debian Buster.
At line 10 changed one line
The JSPWiki Docker image has 3 level parents :
JSPWiki is built from source using [Apache Maven|http://maven.apache.org/] during the image build process.
At line 12 changed 3 lines
* centos7 (the base OS we use, pulled from official centos docker hub)
* java7 installed (see dockerfile for details)
* tomcat 8.0.21 installed (see dockerfile for details)
!! Prerequisites
At line 16 changed one line
As locally seen with the ''docker images'' command :
To use the pre-built image or build one from source you only need a [Docker Engine|https://docs.docker.com/engine/]. See the [installation instructions|http://docs.docker.com/installation/] on the docker site for details.
At line 17 added 3 lines
!! Using the Pre-Built Image
To download it locally from the [docker hub|https://registry.hub.docker.com/r/apache/jspwiki/].
! Get the Image
At line 19 changed 8 lines
[root@vbox dockerfiles]# docker images
REPOSITORY TAG IMAGE ID CREATED VIRTUAL SIZE
harry jspwiki-2.10.2-svn-15 7777554fc2fc 2 minutes ago 618.3 MB
harry tomcat-8.0.21 8c64fd348c41 11 minutes ago 542.7 MB
harry java7 c5eb18fad024 7 days ago 501.5 MB
centos 7 dade6cb4530a 4 weeks ago 224 MB
centos centos7 dade6cb4530a 4 weeks ago 224 MB
centos latest dade6cb4530a 4 weeks ago 224 MB
$ docker pull apache/jspwiki
At line 23 added 4 lines
! Running the Container
{{{
$ docker run -d -p 8080:8080 --name jspwiki apache/jspwiki
}}}
At line 28 added 5 lines
This means :
* __-d__ - detached mode, run the container in the background
* __-p 8080:8080__ - bind the host port (8080) to the container port (8080). JSPWiki always runs on port 8080 inside the container.
* __--name jspwiki__ - the new docker container will get the name ''jspwiki'' (instead of a generated container name)
* __apache/jspwiki__ - the name of the image to run
At line 30 changed one line
!!! What are the prereqs to run it ?
!! Building from Source
! Building the Image
From the source root directory that contains the Dockerfile. The example uses a {{$version}} variable because the version is referred to multiple times. It is optional and can be replaced by any version number you would like to use. If you do not specify a version with the tag name it will default to {{latest}}.
At line 32 changed 3 lines
Well, you "only" need a docker runtime. See the [installation instructions|http://docs.docker.com/installation/] on the docker site for details.
Then you need the image, you can download it from the [docker hub|https://registry.hub.docker.com/u/metskem/jspwiki/]. Just download it with the __docker pull metskem/jspwiki:2.10.2-svn-15__ command :
Watch out for the space and period at the end which means the current directory.
At line 36 changed 15 lines
metskem@athena:~$ docker pull metskem/jspwiki:2.10.2-svn-15
Pulling repository metskem/jspwiki
3e33f5d2d612: Download complete
511136ea3c5a: Download complete
5b12ef8fd570: Download complete
dade6cb4530a: Download complete
<<< snip >>>>
ecdbcd1f656f: Download complete
1471a9d1d1ec: Download complete
95ef590ff04d: Download complete
Status: Downloaded newer image for metskem/jspwiki:2.10.2-svn-15
metskem@athena:~$ docker images
REPOSITORY TAG IMAGE ID CREATED VIRTUAL SIZE
metskem/jspwiki 2.10.2-svn-15 7777554fc2fc 43 hours ago 618.3 MB
metskem@athena:~$
$ version='2.11.0'
$ docker build --tag="jspwiki:$version" .
At line 53 changed 4 lines
!!! How do I run it
The most simple way to go is :
! Running the Container
This is exactly like running the pre-built image except for the image
{{name:version}} at the end.
At line 58 changed one line
docker run -d -p 80:8080 --env="jspwiki.baseURL=http://10.0.0.196/" metskem/jspwiki:2.10.2-svn-15
$ docker run -d -p 8080:8080 --name jspwiki jspwiki:$version
At line 61 changed 5 lines
This means :
* __-d__ - detached mode, run the container in the background
* __-p 80:8080__ - bind the host port (80) to the container port (8080). JSPWiki always runs on port 8080 inside the container.
* __--env="jspwiki.baseURL=http://10.0.0.196/"__ - you have to override this variable, because the jspwiki baseURL must match the URL that you use to access the wiki %%small (the 10.0.0.196 is just an example of course) %%
* __metskem/jspwiki:jspwiki-2.10.2-svn-15__ - the name of the image to run
!! Check the Results
At line 67 changed one line
!!! How can I check it ?
Just point your browser at [http://localhost:8080/], that should give you a working wiki right away!
At line 69 changed 5 lines
You can point your browser at the baseURL of course, that should give you a working wiki right away !
You should also see a running docker container now :
To see the list of running containers use {{docker ps}} or {{docker container ls}} and {{docker ps -a}} or {{docker container ls -a}} will show all containers running and stopped.
At line 75 changed 4 lines
metskem@athena:~$ docker ps
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
c8c73ddd9876 metskem/jspwiki:2.10.2-svn-15 "/bin/sh -c '/usr/lo 3 minutes ago Up 3 minutes 0.0.0.0:80->8080/tcp focused_goldstine
metskem@athena:~$
$ docker ps
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
5f0f5b0b5996 apache/jspwiki "/usr/local/tomcat/bi" 4 minutes ago Up 4 minutes 0.0.0.0:8080->8080/tcp jspwiki
At line 81 changed one line
You can also "log in" to your container with the docker exec command and, for example, look what is in /var/jspwiki :
You can also execute commands inside the jspwiki container with the docker exec command and, for example, look at the last 5 lines in {{/var/jspwiki/logs/jspwiki.log}}:
At line 83 changed 10 lines
metskem@athena:~$ docker exec -ti c8c73ddd9876 bash
[tomcat@c8c73ddd9876 /]$ find /var/jspwiki|head -5
/var/jspwiki
/var/jspwiki/pages
/var/jspwiki/pages/OLD
/var/jspwiki/pages/LoginHelp.txt
/var/jspwiki/pages/ApprovalRequiredForUserProfiles.txt
[tomcat@c8c73ddd9876 /]$ exit
exit
metskem@athena:~$
$ docker exec -ti jspwiki tail -5 /var/jspwiki/logs/jspwiki.log
2016-03-28 09:34:35,070 [localhost-startStop-1] INFO org.apache.wiki.util.UtilJ2eeCompat - apache tomcat detected
2016-03-28 09:34:35,073 [localhost-startStop-1] INFO org.apache.wiki.ajax.WikiAjaxDispatcherServlet - WikiAjaxDispatcherServlet initialized.
2016-03-28 09:34:35,075 [localhost-startStop-1] INFO org.apache.wiki.WikiServlet - WikiServlet initialized.
2016-03-28 09:34:38,054 [http-nio-8080-exec-1] INFO org.apache.wiki.util.PropertyReader JSPWiki:/JSPWiki:http://localhost:8080/ - No jspwiki.custom.config defined for this context, looking for custom properties file with default name of: /jspwiki-custom.properties
2016-03-28 09:34:38,057 [http-nio-8080-exec-1] INFO org.apache.wiki.util.PropertyReader JSPWiki:/JSPWiki:http://localhost:8080/ - No custom property file found, relying on JSPWiki defaults.
At line 95 changed one line
!!! Stopping and starting the container
!! Stopping and Starting the Container
At line 97 changed one line
To stop the container, simply issue the {{docker stop}} command against the containerid (or container name if you gave it a name during first run):
To stop the container, simply issue the {{docker stop}} or {{docker container stop}} command against the containerid (or container name if you gave it a name during first run).
At line 99 changed 11 lines
metskem@athena:~$ docker ps
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
e1892e0fe60a metskem/jspwiki:2.10.2-svn-15 "/bin/sh -c '/usr/lo 3 seconds ago Up 2 seconds 0.0.0.0:80->8080/tcp jspwiki_80
metskem@athena:~$ docker stop jspwiki_80
jspwiki_80
metskem@athena:~$ docker ps
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
metskem@athena:~$ docker ps -a
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
e1892e0fe60a metskem/jspwiki:2.10.2-svn-15 "/bin/sh -c '/usr/lo 46 seconds ago Exited (143) 7 seconds ago jspwiki_80
c8c73ddd9876 metskem/jspwiki:2.10.2-svn-15 "/bin/sh -c '/usr/lo 6 minutes ago Exited (143) About a minute ago focused_goldstine
$ docker ps
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
5f0f5b0b5996 apache/jspwiki "/usr/local/tomcat/bi" 6 minutes ago Up 6 minutes 0.0.0.0:8080->8080/tcp jspwiki
$ docker stop jspwiki
jspwiki
$ docker ps
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
$ docker ps -a
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
5f0f5b0b5996 apache/jspwiki "/usr/local/tomcat/bi" 6 minutes ago Exited (143) 4 seconds ago jspwiki
At line 112 changed one line
You can restart it again with the {{docker start}} command, you have to find the containerid with the {{docker ps -a}} command first , (or simply use the container name if you gave the container a name during first run):
You can restart it with the {{docker start}} or {{docker container start}} command, you have to find the containerid with the {{docker ps -a}} command first , (or simply use the container name if you gave the
container a name during first run):
At line 114 changed 5 lines
metskem@athena:~$ docker start jspwiki_80
jspwiki_80
metskem@athena:~$ docker ps
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
e1892e0fe60a metskem/jspwiki:2.10.2-svn-15 "/bin/sh -c '/usr/lo 2 minutes ago Up About a minute 0.0.0.0:80->8080/tcp jspwiki_80
$ docker start jspwiki
jspwiki
$ docker ps
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
5f0f5b0b5996 apache/jspwiki "/usr/local/tomcat/bi" 7 minutes ago Up 5 seconds 0.0.0.0:8080->8080/tcp jspwiki
At line 101 added one line
!! Removing the Container
At line 124 changed 3 lines
!!! Removing the container
If you want to get rid of the container (and all of the data in it !) you first should stop it, then you can remove it with the {{docker rm}} command:
If you want to get rid of the container (and all of the data in it!) you first should stop it, then you can remove it with the {{docker rm}} or {{docker container rm}} command %%small (or use docker rm -f to
forcibly remove it right away)%%:
At line 128 changed 16 lines
metskem@athena:~$ docker ps
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
e1892e0fe60a metskem/jspwiki:2.10.2-svn-15 "/bin/sh -c '/usr/lo 2 minutes ago Up About a minute 0.0.0.0:80->8080/tcp jspwiki_80
metskem@athena:~$ docker stop jspwiki_80
jspwiki_80
metskem@athena:~$ docker ps
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
metskem@athena:~$ docker ps -a
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
e1892e0fe60a metskem/jspwiki:2.10.2-svn-15 "/bin/sh -c '/usr/lo 2 minutes ago Exited (143) 6 seconds ago jspwiki_80
c8c73ddd9876 metskem/jspwiki:2.10.2-svn-15 "/bin/sh -c '/usr/lo 8 minutes ago Exited (143) 3 minutes ago focused_goldstine
metskem@athena:~$ docker rm jspwiki_80
jspwiki_80
metskem@athena:~$ docker ps -a
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
c8c73ddd9876 metskem/jspwiki:2.10.2-svn-15 "/bin/sh -c '/usr/lo 8 minutes ago Exited (143) 3 minutes ago focused_goldstine
$ docker ps
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
5f0f5b0b5996 apache/jspwiki "/usr/local/tomcat/bi" 9 minutes ago Up About a minute 0.0.0.0:8080->8080/tcp jspwiki
$ docker stop jspwiki
jspwiki
$ docker ps -a
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
5f0f5b0b5996 apache/jspwiki "/usr/local/tomcat/bi" 9 minutes ago Exited (143) 6 seconds ago jspwiki
$ docker rm jspwiki
jspwiki
$ docker ps -a
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
At line 146 changed one line
Note that all your data is lost when you remove the container. (You can keep data apart using docker volumes, see next paragraph)
Note that all your data is lost when you remove the container. (You can keep data apart using Docker Volumes, see next paragraph)
At line 122 added one line
!! ENV variables
At line 149 changed one line
!!! Persistent data
Docker's Environment variables will be passed to the running instance of JSPWiki inside the container, which is able to translate them to something that JSPWiki will understand, i.e., {{ENV jspwiki_use_external_logconfig true}} will be understood by the {{WikiEngine}} as {{jspwiki.use.external.logconfig=true}}, {{ENV jspwiki_pageProvider VersioningFileProvider}} as {{jspwiki.pageProvider VersioningFileProvider}}, and so on.
At line 151 changed 2 lines
If you use docker to run jspwiki only for quick test purposes, you probably are not interested in keeping the data (created/changed pages, registered users, logfiles).\\
But you can also run a jspwiki docker container in production like environments where you want to keep your data even after you removed a container. \\As an example you might sometimes want to run a newer version of your jspwiki docker container.
%%bg-info
%%label-info Tip%% you can use {{ENV jspwiki_custom_config $PATH_TO_FILE_INSIDE_DOCKER_VOLUME}} to load your {{jspwiki-custom.properties}} file to load your JSPWiki customizations, see Persisting Data section below to get a grasp on how to do it.
%%
At line 154 changed one line
To keep data outside of the container, you can use the {{--volume}} switch when you fire up the container :
!! Persisting Data
If you use docker to run JSPWiki only for quick test purposes, you probably are not interested in keeping the data (created/changed pages, registered users, logfiles).\\ But you can also run a JSPWiki docker container in production-like environments where you want to keep your data even after you removed a container. \\As an example you might sometimes want to run a newer version of your JSPWiki Docker container.
! Seeding the Volume Directory
To begin with the default pages you can copy them from the source tree into a host OS directory used to persist the data.
At line 156 changed one line
metskem@athena:~$ docker run -d -p 80:8080 --env="jspwiki.baseURL=http://10.0.0.196/" --name jspwiki_80 --volume="/home/metskem/jspwiki-pages:/var/jspwiki/pages" metskem/jspwiki:2.10.2-svn-15
$ cp ./jspwiki-wikipages/en/src/main/resources/* <path-to-your>/jspwiki-pages/
}}}
! Running with a Volume
To use the data outside of the container, you can use the {{--volume}} switch when you startup the container :
{{{
$ docker run -d -p 8080:8080 --env="jspwiki_baseURL=http://localhost/" --name jspwiki_8080 --volume="<path-to-your>/jspwiki-pages:/var/jspwiki/pages" apache/jspwiki
At line 158 removed 3 lines
metskem@athena:~$ docker ps
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
240232ebb32e metskem/jspwiki:2.10.2-svn-15 "/bin/sh -c '/usr/lo 6 seconds ago Up 6 seconds 0.0.0.0:80->8080/tcp jspwiki_80
At line 147 added one line
This way you will get your pages in a directory on the host OS in {{<path-to-your>/jspwiki-pages}}. You can use the same technique to store the attachments, the log files, the {{jspwiki-custom.properties}} file, etc.
At line 164 changed 3 lines
This way you will get your pages in a directory on the host OS in /home/metskem/jspwiki-pages.\\
Obviously, in this case you will not have the initial set of default pages loaded.
!!! Running multiple instances
__jspwiki.policy + userdatabase.xml (wiki-users) + server.xml__
{{{
$ docker container ls
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
64560e4e56c2 apache/jspwiki "/usr/local/tomcat/b…" 5 days ago Up 6 hours 0.0.0.0:8080->8080/tcp, :::8080->8080/tcp jspwiki_8080
At line 155 added 19 lines
$ docker exec -it jspwiki_8080 /bin/bash
root@64560e4e56c2:/usr/local/tomcat#
root@64560e4e56c2:/usr/local/tomcat/webapps/ROOT/WEB-INF# ls -l
-rw-r--r-- 1 root root 5713 Nov 3 10:53 jspwiki.policy
root@64560e4e56c2:/var/jspwiki/etc# ls -l
-rw-r--r-- 1 root root 881 Nov 3 10:53 groupdatabase.xml
-rw-r--r-- 1 root root 877 Nov 3 10:53 userdatabase.xml
root@64560e4e56c2:/usr/local/tomcat/conf# ls -l
-rw-r--r-- 1 root root 7589 Nov 10 08:26 server.xml
}}}
__
!! Running Multiple Instances
At line 171 changed one line
metskem@athena:~$ for PORT in `seq 9080 9084`; do docker run -d -p ${PORT}:8080 --memory=128m --env="jspwiki.baseURL=http://10.0.0.196:${PORT}/" --name jspwiki-${PORT} metskem/jspwiki:2.10.2-svn-154; done
$ for PORT in `seq 9080 9084`; do docker run -d -p ${PORT}:8080 --memory=128m --env="jspwiki_baseURL=http://localhost:${PORT}/" --name jspwiki-${PORT} metskem/docker-jspwiki; done
At line 177 changed 9 lines
metskem@athena:~$ docker ps
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
73d4cd8f29a0 metskem/jspwiki:2.10.2-svn-15 "/bin/sh -c '/usr/lo 4 seconds ago Up 3 seconds 0.0.0.0:9084->8080/tcp jspwiki-9084
b55b716ed49f metskem/jspwiki:2.10.2-svn-15 "/bin/sh -c '/usr/lo 4 seconds ago Up 3 seconds 0.0.0.0:9083->8080/tcp jspwiki-9083
6a23a3ac3df9 metskem/jspwiki:2.10.2-svn-15 "/bin/sh -c '/usr/lo 4 seconds ago Up 3 seconds 0.0.0.0:9082->8080/tcp jspwiki-9082
b3b967dc4fe7 metskem/jspwiki:2.10.2-svn-15 "/bin/sh -c '/usr/lo 5 seconds ago Up 4 seconds 0.0.0.0:9081->8080/tcp jspwiki-9081
68481eed8d60 metskem/jspwiki:2.10.2-svn-15 "/bin/sh -c '/usr/lo 5 seconds ago Up 4 seconds 0.0.0.0:9080->8080/tcp jspwiki-9080
}}}
$ docker ps
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
73d4cd8f29a0 apache/jspwiki "/bin/sh -c '/usr/lo 4 seconds ago Up 3 seconds 0.0.0.0:9084->8080/tcp jspwiki-9084
b55b716ed49f apache/jspwiki "/bin/sh -c '/usr/lo 4 seconds ago Up 3 seconds 0.0.0.0:9083->8080/tcp jspwiki-9083
6a23a3ac3df9 apache/jspwiki "/bin/sh -c '/usr/lo 4 seconds ago Up 3 seconds 0.0.0.0:9082->8080/tcp jspwiki-9082
b3b967dc4fe7 apache/jspwiki "/bin/sh -c '/usr/lo 5 seconds ago Up 4 seconds 0.0.0.0:9081->8080/tcp jspwiki-9081
68481eed8d60 apache/jspwiki "/bin/sh -c '/usr/lo 5 seconds ago Up 4 seconds 0.0.0.0:9080->8080/tcp jspwiki-9080
At line 191 added 2 lines
}}}
At line 189 changed one line
metskem@athena:~$ docker stop `docker ps -aq`
$ docker stop `docker ps -aq`
At line 197 changed one line
metskem@athena:~$ docker rm `docker ps -aq`
$ docker rm `docker ps -aq`
At line 205 changed 2 lines
metskem@athena:~$ docker ps -a
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
$ docker ps -a
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
At line 209 changed one line
!!! Used docker files
!! Customizing Your Image
You can customize your build by making source code changes (not covered here) or change other things like the Tomcat base image version and platform OS and JDK version.
At line 211 changed one line
I have been using the following docker files for this JSPWiki images:
__Example__: Change the platform OS from Debian to the CentOS based variation Amazon Linux 2 that uses their Corretto JDK optimized to run in AWS. Edit the Dockerfile as follows:\\
At line 213 changed 2 lines
!! Java 7
%%prettify
Change the Maven image used for building JSPWiki to match the one for the OS. (Probably not need but done for consistency)
At line 216 changed 8 lines
#
# Dockerfile with OpenJDK7 on top of CentoS 7
#
FROM centos:centos7
MAINTAINER Harry Metske <harry.metske@gmail.com>
RUN yum -y update
RUN yum -y install java-1.7.0-openjdk
CMD /bin/bash
# FROM maven:3.8-jdk-8 as package
FROM maven:3.8-amazoncorretto-11 as package
At line 225 changed 4 lines
%%
!! Tomcat 8.0.21
%%prettify
Change the Tomcat base image
At line 230 changed 24 lines
#
# Dockerfile for a running tomcat 8.0.21 on top of OpenJDK7 on top of CentoS 7
# Also install tar, needed for unpacking the tomcat archive.
#
FROM harry:java7
MAINTAINER Harry Metske <harry.metske@gmail.com>
RUN yum -y update
RUN yum -y install tar
RUN curl http://apache.proserve.nl/tomcat/tomcat-8/v8.0.21/bin/apache-tomcat-8.0.21.tar.gz | gunzip | tar -x -C /usr/local
RUN useradd tomcat
RUN cd /usr/local && ln -s apache-tomcat-8.0.21 tomcat
RUN chown -R tomcat.tomcat /usr/local/tomcat /usr/local/apache-tomcat-8.0.21
ENV HOME /home/tomcat
USER tomcat
EXPOSE 8080
# remove stuff we don't need
RUN rm -rf /usr/local/tomcat/bin/*.bat
# provide access to tomcat manager application with user/pw = admin/admin :
RUN echo -e '<?xml version="1.0" encoding="utf-8"?>\n<tomcat-users>\n<role rolename="manager-gui"/>\n<role rolename="manager-script"/>\n<role rolename="manager-jmx"/>\n<role rolename="manager-status"/>\n<role rolename="admin"/>\n<user username="admin" password="admin" roles="manager,manager-gui,manager-script,manager-jmx,manager-status"/>\n</tomcat-users>' > /usr/local/tomcat/conf/tomcat-users.xml
# We want logging to get out of the container:
# VOLUME /usr/local/tomcat/logs
#
# by default we start the Tomcat container when the docker container is started.
CMD ["/usr/local/tomcat/bin/catalina.sh","run"]
# FROM tomcat:9.0
FROM tomcat:9.0-jdk11-corretto
At line 255 changed 4 lines
%%
!! JSPWiki 2.10.2-svn-15
%%prettify
Replace some Debian specific lines with RedHat counterparts to add the
unzip package.
At line 260 changed 53 lines
#
# Dockerfile for JSPWiki running in a tomcat 8 on top of OpenJDK7 on top of CentoS 7
# Also install unzip, needed to unzip the default wikipages.
#
FROM harry:tomcat-8.0.21
MAINTAINER Harry Metske <metskem@apache.org>
# we need the unzip command to unpack the war and zip files
USER root
RUN yum -y update
RUN yum install -y unzip
# create a directory where all jspwiki stuff will live
RUN mkdir /var/jspwiki
RUN chown tomcat.tomcat /var/jspwiki
#
USER tomcat
# first remove default tomcat applications, we dont need them to run jspwiki
RUN cd /usr/local/tomcat/webapps && rm -rf examples host-manager manager docs ROOT
# create subdirectories where all jspwiki stuff will live
RUN cd /var/jspwiki && mkdir pages logs etc work
#
RUN mkdir /usr/local/tomcat/webapps/ROOT
#
# download the war from a fixed download location, create JSPWiki webapps dir, unzip it there.
RUN TF=/tmp/jspwiki.download.war && curl --silent --insecure https://www.computerhok.nl/tmp/JSPWiki.war > $TF && unzip -q -d /usr/local/tomcat/webapps/ROOT $TF && rm $TF
#
# download the default set of pages
RUN TF=/tmp/jspwikipages-download.zip && curl --silent http://apache.xl-mirror.nl/jspwiki/2.10.1/wikipages/jspwiki-wikipages-en-2.10.1.zip > $TF && unzip -q -d /tmp $TF && mv /tmp/jspwiki-wikipages-en-2.10.1/* /var/jspwiki/pages && rm -r $TF /tmp/jspwiki-wikipages-en-2.10.1
#
# move the userdatabase.xml and groupdatabase to /var/jspwiki/etc
RUN cd /usr/local/tomcat/webapps/ROOT/WEB-INF && mv userdatabase.xml groupdatabase.xml /var/jspwiki/etc
#
# arrange proper logging (jspwiki.use.external.logconfig = true needs to be set)
RUN echo -e \
"log4j.rootLogger=info,FileLog\n\
log4j.appender.FileLog = org.apache.log4j.RollingFileAppender\n\
log4j.appender.FileLog.MaxFileSize = 10MB\n\
log4j.appender.FileLog.MaxBackupIndex = 14\n\
log4j.appender.FileLog.File = /var/jspwiki/logs/jspwiki.log\n\
log4j.appender.FileLog.layout = org.apache.log4j.PatternLayout\n\
log4j.appender.FileLog.layout.ConversionPattern = %d [%t] %p %c %x - %m%n\n" > /usr/local/tomcat/lib/log4j.properties
#
# set default environment entries to configure jspwiki
ENV LANG en_US.UTF-8
ENV jspwiki.pageProvider VersioningFileProvider
ENV jspwiki.fileSystemProvider.pageDir /var/jspwiki/pages
ENV jspwiki.basicAttachmentProvider.storageDir /var/jspwiki/pages
ENV jspwiki.workDir /var/jspwiki/work
ENV jspwiki.xmlUserDatabaseFile /var/jspwiki/etc/userdatabase.xml
ENV jspwiki.xmlGroupDatabaseFile /var/jspwiki/etc/groupdatabase.xml
ENV jspwiki.use.external.logconfig true
#
# by default we start the Tomcat container when the docker container is started.
CMD ["/usr/local/tomcat/bin/catalina.sh","run", ">/usr/local/tomcat/logs/catalina.out"]
# RUN set -x \
# && export DEBIAN_FRONTEND=noninteractive \
# && apt install --fix-missing --quiet --yes unzip
RUN yum -y install \
unzip
At line 314 changed one line
%%
Add after the {{# install jspwiki}} section and before {{# make port
visible in metadata}}
{{{
# remove unzip and cleanup
RUN yum -y remove \
unzip \
&& yum clean all
}}}
That's all... Enjoy!
[{PageViewPlugin}]