[英]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. 根据文档,下面的docker映像定义不包含SQL Server驱动程序。
How can I install it? 如何安装?
Documentation: https://github.com/camunda/docker-camunda-bpm-platform 文档: https : //github.com/camunda/docker-camunda-bpm-platform
Docker File Docker文件
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 .
I was able to make it work after several days. 几天后我就能使它工作。
Steps 脚步
Only line needs to add in DOCKER file is: 只需在DOCKER文件中添加以下行:
#MSSQL SERVER JDBC DRIVER INSTALL
COPY mssql-jdbc-7.2.2.jre11.jar /camunda/lib/
According to the documentation you refer to, Microsoft SQL Server is not supported. 根据您引用的文档,不支持Microsoft SQL Server。
So while you could try some exercise of downloading the JDBC driver ( https://docs.microsoft.com/en-us/sql/connect/jdbc/download-microsoft-jdbc-driver-for-sql-server?view=sql-server-2017 ) and then add it to the Docker image and the classpath: 因此,尽管您可以尝试一些下载JDBC驱动程序的练习( https://docs.microsoft.com/zh-cn/sql/connect/jdbc/download-microsoft-jdbc-driver-for-sql-server?view=sql -server-2017 ),然后将其添加到Docker映像和类路径中:
COPY name_of_jdbc_driver.jar /camunda/mssqlserver.jdbc
env CLASSPATH=/camunda/mssqlserver.jdbc
It's more than likely that this won't work because the camunda software does not support MS SQL Server. 由于camunda软件不支持MS SQL Server,因此很有可能无法正常工作。
So you should consider simply using one of the other databases that they explicitly support. 因此,您应该考虑只使用它们明确支持的其他数据库之一。 I'd recommend PostgreSQL for example.
例如,我建议使用PostgreSQL。 It's free (as in beer and speech) and you can use it in production if you want to.
它是免费的(例如啤酒和演讲),并且您可以在生产中使用它。
If you're just looking to do some testing and don't need this in a production environment. 如果您只是想进行一些测试,而在生产环境中不需要这样做。 The instructions you point to have a decent explanation on how to start PostgreSQL in a Docker container and then start the Camunda container that uses the PostgreSQL container as a database.
您指向的说明对如何在Docker容器中启动PostgreSQL以及如何启动将PostgreSQL容器用作数据库的Camunda容器有一个不错的解释。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.