根据此Github示例构建Weblogic 12.1.3 docker镜像:oracle-docker-images/OracleWebLogic。我已经编写了自己的Dockerfile来设置应用程序的Weblogic域。这是我的Dockerfile:
# LICENSE UPL 1.0
#
# Copyright (c) 2014-2018 Oracle and/or its affiliates. All rights reserved.
#
# ORACLE DOCKERFILES PROJECT
# --------------------------
# This Dockerfile extends the Oracle WebLogic image by creating a sample domain.
#
# The 'TRAD08' created here has Java EE 7 APIs enabled by default:
# - JAX-RS 2.0 shared lib deployed
# - JPA 2.1,
# - WebSockets and JSON-P
#
# Util scripts are copied into the image enabling users to plug NodeManager
# magically into the AdminServer running on another container as a Machine.
#
# HOW TO BUILD THIS IMAGE
# -----------------------
# Put all downloaded files in the same directory as this Dockerfile
# Run:
# $ sudo docker build -t 1213-domain --build-arg ADMIN_PASSWORD=welcome1 .
#
# Pull base image
# ---------------
FROM oracle/weblogic:12.1.3-developer
# Maintainer
# ----------
MAINTAINER MedAoutir
# WLS Configuration
# -------------------------------
ARG ADMIN_PASSWORD
ARG PRODUCTION_MODE
ENV PRE_DOMAIN_HOME=/u01/oracle/user_projects \
ADMIN_PORT="7001" \
ADMIN_HOST="wlsadmin" \
NM_PORT="5556" \
CONFIG_JVM_ARGS="-Dweblogic.security.SSL.ignoreHostnameVerification=true" \
PATH=$PATH:/u01/oracle/oracle_common/common/bin:/u01/oracle/wlserver/common/bin:$PRE_DOMAIN_HOME/domains/TRAD08:$PRE_DOMAIN_HOME/domains/TRAD08/bin:/u01/oracle
ENV MW_HOME="/u01/oracle" \
DATASOURCE_SCRIPT="/share/tradeworks/scripts/Weblogic12c/setup_datasource.py" \
JMS_SCRIPT="/share/tradeworks/scripts/Weblogic12c/setup_jms.py" \
DEPLOY_SCRIPT="/share/tradeworks/scripts/Weblogic12c/deploy_libraries_VM.py" \
WEBLOGIC_ENV="/share/tradeworks/scripts/Weblogic12c/environments/" \
WEBLOGIC_WLST="weblogic.WLST" \
WEBLOGIC_MANAGEMENT="-Dweblogic.management.GenerateDefaultConfig=true" \
WEBLOGIC_DOMAIN="-Dweblogic.Domain=TRAD08" \
WEBLOGIC_NAME="-Dweblogic.Name=Tradeworks" \
WEBLOGIC_USERNAME="-Dweblogic.management.username=weblogic" \
MS_PORT="7008" \
WEBLOGIC_PASSWORD="-Dweblogic.management.password=${ADMIN_PASSWORD}" \
WEBLOGIC_LISTENPORT="-Dweblogic.ListenPort=${MS_PORT:-7008}" \
WEBLOGIC_SERVER="weblogic.Server" \
DOMAIN_NAME="TRAD08" \
DEPLOYABLE_LIB_BASH="bash -c 'cd /opt/tools/Servers/Oracle/WebLogic/12.1.3/server/wls12130/wlserver/common/deployable-libraries/ \
wget https://chci.sgs.net/nexus/service/local/repositories/releases/content/com/sgs/weblogic/library/bc4j/bc4j-lib-4weblogic/10.1.3.41.57/bc4j-lib-4weblogic-10.1.3.41.57-jar-with-dependencies.jar \
sudo cd /share/tradeworks/ \
sudo ln -s /media/sf_Y_DRIVE/tradeworks/scripts scripts \
export MW_HOME=$MW_HOME \
$SHELL'"
#PERMISSION_BASH="chmod +x /opt/tools/Servers/OraFROMcle/WebLogic/12.1.3/domains/Tradeworks/master/TRAD08/bin/setUserOverrides.sh\
# $SHELL'" \
# Add files required to build this image
COPY container-scripts/* /u01/oracle/
# Configuration of WLS Domain
USER root
WORKDIR /u01/oracle
RUN /u01/oracle/wlst /u01/oracle/create-wls-domain.py && \
mkdir -p $PRE_DOMAIN_HOME && \
chmod a+xr $PRE_DOMAIN_HOME && \
chown -R oracle:oracle $PRE_DOMAIN_HOME && \
mkdir -p $PRE_DOMAIN_HOME/domains/$DOMAIN_NAME/servers/AdminServer/security && \
echo "username=weblogic" > $PRE_DOMAIN_HOME/domains/$DOMAIN_NAME/servers/AdminServer/security/boot.properties && \
echo "password=${ADMIN_PASSWORD}" >> $PRE_DOMAIN_HOME/domains/$DOMAIN_NAME/servers/AdminServer/security/boot.properties && \
echo ". ${PRE_DOMAIN_HOME}/domains/base_domain/bin/setDomainEnv.sh" >> /u01/oracle/.bashrc && \
echo "export PATH=${PATH:-/u01/oracle/wlserver/common/bin:$PRE_DOMAIN_HOME/domains/${DOMAIN_NAME}/bin}" >> /u01/oracle/.bashrc && \
cp /u01/oracle/commEnv.sh /u01/oracle/wlserver/common/bin/commEnv.sh && \
rm /u01/oracle/create-wls-domain.py /u01/oracle/jaxrs2-template.jar
#Setup Weblogic Server
WORKDIR $MW_HOME/wlserver/server/bin
RUN . ./setWLSEnv.sh
WORKDIR $PRE_DOMAIN_HOME/domains/${DOMAIN_NAME}
RUN ls
RUN $JAVA_HOME/bin/java -Xms512m -Xmx1024m -XX:MaxPermSize=512m -Djava.security.egd=file:/dev/./urandom -Dweblogic.management.GenerateDefaultConfig=true -Dweblogic.Domain=TRAD08 -Dweblogic.Name=Tradeworks -Dweblogic.management.username=weblogic -Dweblogic.management.password=$ADMIN_PASSWORD -Dweblogic.ListenPort=$MS_PORT weblogic.Server
# Expose Node Manager default port, and also default http/https ports for admin console
EXPOSE $NM_PORT $ADMIN_PORT $MS_PORT
USER oracle
WORKDIR $PRE_DOMAIN_HOME/domains/${DOMAIN_NAME}
#CMD ["/u01/oracle/user_projects/domains/TRAD08/startWebLogic.sh"]
首先设置环境变量,然后配置WLS域,但是当我尝试构建上述Dockerfile时,出现此错误:
错误:找不到或加载主类weblogic.Server
我知道应该通过执行 从类路径中加载weblogic.Server。 ./setWLSEnv.sh (请参阅 设置Weblogic Server 部分);尽管此脚本之前已经执行过,但是我遇到了同样的问题。
预先感谢您的帮助。