!!! Docker for JSPWiki
After some experiments with [Docker] I came up with a working solution for running JSPWiki in Tomcat on Linux in a Docker container.
[{TableOfContents }]
!!! What container is it ?
The JSPWiki Docker image has 3 level parents :
* centos7 (the base OS we use, pulled from official centos docker hub)
* java7 installed (see dockerfile for details)
* tomcat 8.0.20 installed (see dockerfile for details)
As locally seen with the ''docker images'' command :
{{{
[root@vbox dockerfiles]# docker images
REPOSITORY TAG IMAGE ID CREATED VIRTUAL SIZE
harry jspwiki-2.10.2-svn-14 3e33f5d2d612 2 minutes ago 618.3 MB
harry tomcat-8.0.20 d9e7a3a95230 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
}}}
!!! What do I need to run it ?
Well, the is simple, you "only" need a docker runtime. See the [installation instructions|http://docs.docker.com/installation/] on the docker site.
Then you need the image, well I uploaded it to the docker hub, see : [to come]
!!! How do I run it
The most simple way to go is :
{{{
docker run -d -p 80:8080 --env="jspwiki.baseURL=http://10.0.0.196/" harry:jspwiki-2.10.2-svn-14
}}}
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) %%
* __harry:jspwiki-2.10.2-svn-14__ - the name of the image to run
!!! How can I check it ?
You can point your browser at the baseURL of course, that should give you a working wiki right away !
You should see a process running on your host container:
{{{
[root@vbox dockerfiles]# ps -ef|grep tomcat
centos 11909 1070 5 19:12 ? 00:00:38 java -Djava.util.logging.config.file=/usr/local/tomcat/conf/logging.properties -Djava.util.logging.manager=org.apache.juli.ClassLoaderLogManager -Djava.endorsed.dirs=/usr/local/tomcat/endorsed -classpath /usr/local/tomcat/bin/bootstrap.jar:/usr/local/tomcat/bin/tomcat-juli.jar -Dcatalina.base=/usr/local/tomcat -Dcatalina.home=/usr/local/tomcat -Djava.io.tmpdir=/usr/local/tomcat/temp org.apache.catalina.startup.Bootstrap start
}}}
You should also see a running docker container now :
{{{
[root@vbox dockerfiles]# docker ps
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
e1da0696c689 harry:jspwiki-2.10.2-svn-14 "/bin/sh -c '/usr/lo 13 minutes ago Up 13 minutes 0.0.0.0:80->8080/tcp jspwiki_80
}}}
You can also "log in" to your container with the docker exec command and look what is in /var/jspwiki :
{{{
[root@vbox dockerfiles]# docker exec -ti jspwiki_80 bash
[tomcat@e1da0696c689 /]$ find /var/jspwiki | head -5
/var/jspwiki
/var/jspwiki/pages
/var/jspwiki/pages/LoginHelp.txt
/var/jspwiki/pages/CopyrightNotice.txt
/var/jspwiki/pages/LeftMenu.txt
[tomcat@e1da0696c689 /]$ exit
exit
[root@vbox dockerfiles]#
}}}
!!! TODO
* stop the container
* remove the container
* multiple instances
* persistent pages, howto