Public Repository

Last pushed: a year ago
Short Description
Extends the db2 image with Java with a Java SQL script executer
Full Description


This dockerfile takes the db2-express image with Java8 installed and installs the

small dbscript executer program which executes scripts on a 1 time basis.

It moves the scripts from a "todo" to a "done" folder to indicate that the file was processed


This means that if the same container is stopped and started then the DB2 will simply start

and will not try and recreate the schema.


USER db2inst1

RUN mkdir /home/db2inst1/script-executor && \
mkdir /home/db2inst1/script-executor/todo

COPY db-script-executer-1.0.0-SNAPSHOT.jar /home/db2inst1/script-executor
RUN echo "jdbc.url=jdbc:db2://localhost:50000/test" > /home/db2inst1/script-executor/ && \
echo "jdbc.user=db2inst1" >> /home/db2inst1/script-executor/ && \
echo "jdbc.password=password" >> /home/db2inst1/script-executor/ && \
echo "" >> /home/db2inst1/script-executor/

#Create a log4j properties file
COPY /home/db2inst1/script-executor/

Create the run script which launches the Java ScriptExecuter application

RUN echo "#!/bin/bash" > /home/db2inst1/script-executor/ && \
echo "cd /home/db2inst1/script-executor/" >> /home/db2inst1/script-executor/ && \
echo "java -cp db-script-executer-1.0.0-SNAPSHOT.jar com.scott.dbscriptexecuter.ScriptExecuter" >> /home/db2inst1/script-executor/ && \
chmod uga+x /home/db2inst1/script-executor/

ENTRYPOINT . /home/db2inst1/sqllib/db2profile && db2start && /home/db2inst1/script-executor/ && echo "DB2 Ready" && tail -f /dev/null

Docker Pull Command