我有一个Java EE8应用程序,该应用程序部署在JBoss WildFly 16.0.0.Final上,并使用Hibernate OGM访问MongoDB。
我已经构建了一个自定义的Docker容器
FROM jboss/wildfly
# ARG are also known as build-time variables
ARG EAR_FILE=./build/libs/GoStopHandle.ear
ARG WILDFLY_MODULES=./wildfly-as/16.0.0.Final/modules
# Add
COPY ${WILDFLY_MODULES}/system/layers/base/org/hibernate/search/ /opt/jboss/wildfly/modules/system/layers/base/org/hibernate/search/
COPY ${WILDFLY_MODULES}/org/hibernate/hql/ /opt/jboss/wildfly/modules/org/hibernate/hql/
COPY ${WILDFLY_MODULES}/org/hibernate/ogm/ /opt/jboss/wildfly/modules/org/hibernate/ogm/
COPY ${WILDFLY_MODULES}/system/layers/base/org/apache/lucene/ /opt/jboss/wildfly/modules/system/layers/base/org/apache/lucene/
COPY ./mysqldatabase/mysql/main/ /opt/jboss/wildfly/modules/system/layers/base/com/mysqldatabase/mysql/main/
RUN ls -la /opt/jboss/wildfly/modules/system/layers/base/com/mysqldatabase/mysql/main/
RUN ls -la /opt/jboss/wildfly/modules/system/layers/base/org/hibernate/search/
RUN ls -la /opt/jboss/wildfly/modules/org/hibernate/hql/
RUN ls -la /opt/jboss/wildfly/modules/org/hibernate/ogm/
RUN ls -la /opt/jboss/wildfly/modules/system/layers/base/org/apache/lucene/
#ADD standalone-full.xml /opt/jboss/wildfly/standalone/configuration/
#RUN ls -la /opt/jboss/wildfly/standalone/configuration/
#ADD standalone.conf /opt/jboss/wildfly/bin/
#RUN ls -la /opt/jboss/wildfly/bin/
# Add the GoStopHandle ear to the container
ADD ${EAR_FILE} /opt/jboss/wildfly/standalone/deployments/
RUN /opt/jboss/wildfly/bin/add-user.sh admin welcome1 --silent
CMD ["/opt/jboss/wildfly/bin/standalone.sh", "-b", "0.0.0.0", "-bmanagement", "0.0.0.0"]
并为Hibernate OGM添加了必需的模块/ JARS,并添加了我的EAR。
我可以构建并运行Docker镜像,尽管它无法连接到MongoDB容器,但它可以正常运行。我需要添加数据源等。
容器ID图像命令
创建的状态端口
名称f0e0c4a948ec gostophandle“ / opt / jboss / wildfly /…”
22小时前上22小时0.0.0.0:32779->8080/tcp
blissful_newton 93e95917216d mongo
“ docker-entrypoint.s…” 22小时之前22小时
0.0.0.0:27017-27019->27017-27019/tcp goStopHandleMongo
所以我添加了我的名字:standalone.conf和standalone-full.xml
ADD standalone-full.xml /opt/jboss/wildfly/standalone/configuration/
ADD standalone.conf /opt/jboss/wildfly/bin/
即使构建了Docker映像,它现在也不会运行,只会返回:
MacBook-Pro:GoStopHandle NOTiFY$ sudo docker run -d -p 8080 gostophandle:latest
Password:
f3a6b533893f0cbfc8ab14604c7a780440ff8b568c2136a2c7db11ffa856939c
MacBook-Pro:GoStopHandle NOTiFY$
答案 0 :(得分:0)
您可以切换到您的
独立配置
-Djboss.server.default.config=standalone-my-full.xml