Skip to content
Advertisement

How do I install a SQL Server Java driver into a linux docker container?

The docker image definition below does not contain according to the documentation a SQL Server driver.

How can I install it?

Documentation: https://github.com/camunda/docker-camunda-bpm-platform

Docker File

FROM alpine:3.10 as builder

ARG VERSION=7.12.0
ARG DISTRO=tomcat
ARG SNAPSHOT=true

ARG EE=false
ARG USER
ARG PASSWORD

RUN apk add --no-cache 
        ca-certificates 
        maven 
        tar 
        wget 
        xmlstarlet

COPY settings.xml download.sh camunda-tomcat.sh camunda-wildfly.sh  /tmp/

RUN /tmp/download.sh


##### FINAL IMAGE #####

FROM alpine:3.10

ARG VERSION=7.12.0

ENV CAMUNDA_VERSION=${VERSION}
ENV DB_DRIVER=org.h2.Driver
ENV DB_URL=jdbc:h2:./camunda-h2-dbs/process-engine;MVCC=TRUE;TRACE_LEVEL_FILE=0;DB_CLOSE_ON_EXIT=FALSE
ENV DB_USERNAME=sa
ENV DB_PASSWORD=
ENV DB_CONN_MAXACTIVE=20
ENV DB_CONN_MINIDLE=5
ENV DB_CONN_MAXIDLE=20
ENV DB_VALIDATE_ON_BORROW=false
ENV DB_VALIDATION_QUERY="SELECT 1"
ENV SKIP_DB_CONFIG=
ENV WAIT_FOR=
ENV WAIT_FOR_TIMEOUT=30
ENV TZ=UTC
ENV DEBUG=false
ENV JAVA_OPTS="-Xmx768m -XX:MaxMetaspaceSize=256m"

EXPOSE 8080 8000

# Downgrading wait-for-it is necessary until this PR is merged
# https://github.com/vishnubob/wait-for-it/pull/68
RUN apk add --no-cache 
        bash 
        ca-certificates 
        openjdk11-jre-headless 
        tzdata 
        tini 
        xmlstarlet 
    && wget -O /usr/local/bin/wait-for-it.sh 
      "https://raw.githubusercontent.com/vishnubob/wait-for-it/a454892f3c2ebbc22bd15e446415b8fcb7c1cfa4/wait-for-it.sh" 
    && chmod +x /usr/local/bin/wait-for-it.sh

RUN addgroup -g 1000 -S camunda && 
    adduser -u 1000 -S camunda -G camunda -h /camunda -s /bin/bash -D camunda
WORKDIR /camunda
USER camunda

ENTRYPOINT ["/sbin/tini", "--"]
CMD ["./camunda.sh"]

COPY --chown=camunda:camunda --from=builder /camunda .

Advertisement

Answer

I was able to make it work after several days.

Steps

  1. Download JDBC Driver from Microsoft Site, Version 7.2, it will include 2 JAR FILES
  2. Uncompress, and copy the file into your docker folder
  3. Copy the file into the camunda LIB folder, this is not explained anywhere, but after a short chat with camunda docker git repo people, they adviced me to do that.

Only line needs to add in DOCKER file is:

#MSSQL SERVER JDBC DRIVER INSTALL
COPY mssql-jdbc-7.2.2.jre11.jar /camunda/lib/
User contributions licensed under: CC BY-SA
7 People found this is helpful
Advertisement