Docker ImagesΒΆ

Two Docker images are used in this tutorial:

  1. A custom sample Docker Hub image gforghetti/tomcat-wildbook:latest which installs Tomcat and the Wildbook application.
  2. The official mysql:latest base Docker Hub image.

The custom sample Docker Hub image gforghetti/tomcat-wildbook:latest was built from the Docker Hub public official repository tomcat:latest image.

The following Dockerfile was used to create the image:

FROM tomcat:latest
MAINTAINER Gary Forghetti <gary.forghetti@enstratius.com>

RUN apt-get update -qq
RUN which curl || apt-get install curl -y
RUN which jar || apt-get install openjdk-7-jdk -y

WORKDIR /tmp

# Copy the Wildbook configuration file from the docker build directory to the docker container's /tmp directory
COPY ./jdoconfig.properties jdoconfig.properties
# Set the permissions of the configuration file
RUN chmod 600 ./jdoconfig.properties

# curl down the Wildbook war file from the Wildbook download site
RUN curl -OL http://www.wildme.org/wildbook/data/media/wildbook-5.3.0-RELEASE.war
# Extract the war file
RUN jar -xf ./wildbook-5.3.0-RELEASE.war
# Now remove the war file
RUN rm -f ./wildbook-5.3.0-RELEASE.war 
# Replace the Wildbook configuration file
RUN mv ./jdoconfig.properties ./WEB-INF/classes/bundles/jdoconfig.properties
# Create a new Wildbook jar file with the updated configuration file
RUN jar -cf ./wildbook-5.3.0-RELEASE.war .
# Now move the Wildbook war file to the Tomcat webapps directory
RUN mv ./wildbook-5.3.0-RELEASE.war /usr/local/tomcat/webapps/wildbook-5.3.0-RELEASE.war

# Start Tomcat when the container is run
CMD ["catalina.sh", "run"]

The following custom Wildbook configuration file jdoconfig.properties was used.

##################################################################################################
# This properties file contains the Wildbook DataNucleus MySQL database configuration parameters. 
##################################################################################################

##################################################################################################
# The following three lines create a connection to the MySQL shepherd database.
##################################################################################################
datanucleus.ConnectionDriverName=com.mysql.jdbc.Driver
datanucleus.ConnectionURL=jdbc:mysql://mysql-wildbook:3306/shepherd
javax.jdo.PersistenceManagerFactoryClass = org.datanucleus.api.jdo.JDOPersistenceManagerFactory     
##################################################################################################

datanucleus.ConnectionUserName = shepherd              
datanucleus.ConnectionPassword = shepherd
datanucleus.autoCreateSchema = true
datanucleus.NontransactionalRead = true        
datanucleus.Multithreaded = true
datanucleus.RestoreValues = true
datanucleus.storeManagerType = rdbms

To run this tutorial you do not need a user account on Docker Hub nor do you need to build a Docker Image. You can use the gforghetti/tomcat-wildbook:latest image.