docker build -t tumcyk/h2-database -f ./Dockerfile-h2db .
docker run -it -v ~/h2-databases:/h2_databases -p 9092:9092 --name h2-database tumcyk/h2-database
This image is built with local resources such as ./resources/h2-2016-05-26.zip downloaded in ./resources directory and Dockerfile refers to them when building.
The port is exposed to the host in the Dockerfile and then to the world in -p 9092:9092 for changing it change EXPOSE in the Dockerfile.
Created ~/h2-databases folder will be given root:root ownership.
FROM ubuntu:14.04
MAINTAINER Tomasz Kuśmierczyk [email protected]
ADD resources/ /home/resources
RUN apt-get update && apt-get install -y --no-install-recommends
ca-certificates
git
unzip
&& rm -rf /var/lib/apt/lists/*
#install Java from local resources
RUN mkdir -p /usr/lib/jvm
RUN tar -xzf /home/resources/jdk-8u101-linux-x64.tar.gz -C /usr/lib/jvm
RUN ln -s /usr/lib/jvm/jdk1.8.0_101 /usr/lib/jvm/java-8-oracle
RUN update-alternatives --install "/usr/bin/java" "java" "/usr/lib/jvm/java-8-oracle/bin/java" 1
ENV JAVA_HOME /usr/lib/jvm/java-8-oracle
RUN unzip /home/resources/h2-2016-10-31.zip -d /usr/lib ENV H2_HOME /usr/lib/h2 ENV DATA_DIR /h2_databases RUN mkdir ${DATA_DIR}
WORKDIR $H2_HOME/bin
EXPOSE 9092
ENV PATH $H2_HOME/bin:$PATH
ENTRYPOINT java -jar h2-1.4.193.jar -web -webAllowOthers -tcp -tcpAllowOthers -browser -baseDir ${DATA_DIR}
Tag ifexists is a version disabling creation of database on connection. Use this version in running semi-production mode and latest for creating databases.
Content type
Image
Digest
Size
450.1 MB
Last updated
over 9 years ago
docker pull tumcyk/h2-database