本篇内容主要讲解“如何使用docker部署WebLogic Server”,感兴趣的朋友不妨来看看。本文介绍的方法操作简单快捷,实用性强。下面就让小编来带大家学习“如何使用docker部署WebLogic Server”吧!
使用docker部署WebLogic Server:
安装和运行:
PRE:首先从Gitgub下载Oracle/docker-images repo:
git clone https://github.com/oracle/docker-images.git
构建Oracle JDK (Server JRE)基础镜像
1、必须首先下载Oracle Server JRE二进制文件到docker-images/OracleJava/java-8目录下:
[root@localhost docker-images]# ls
CODEOWNERS GraalVM OpenJDK OracleCoherence OracleEDQ OracleHTTPServer OracleRestDataServices OracleUnifiedDirectory README.md
ContainerCloud LICENSE OracleBI OracleDatabase OracleFMWInfrastructure OracleInstantClient OracleSOASuite OracleWebCenterSites
CONTRIBUTING.md NoSQL OracleCloudInfrastructure OracleDataIntegrator OracleGoldenGate OracleJava OracleTuxedo OracleWebLogic
[root@localhost docker-images]# cd OracleJava/
[root@localhost OracleJava]# ls
java-8 README.md windows-java-8
NOTE:直接从Oracle网站wget下载无法解压,需要先用个人电脑下载到本地,再用ftp工具传输至指定目录下
在java-8目录下构建镜像:
[root@localhost java-8]# docker build -t oracle/serverjre:8 .
//查看镜像
[root@localhost java-8]# docker images
oracle/serverjre 8 c3b09223bbdd 3 days ago 269MB
构建WebLogic Docker install 镜像
IMPORTANT:需要下载你所选择的WebLogic源码至对应的目录下,下载方式同上,详细请看dockerfiles/<version>/*.download文件。
[root@localhost OracleWebLogic]# ls
COPYRIGHT dockerfiles LICENSE README.md samples workshops
[root@localhost OracleWebLogic]# cd dockerfiles/
[root@localhost dockerfiles]# ls
12.1.3 12.2.1 12.2.1.1 12.2.1.2 12.2.1.3 buildDockerImage.sh
运行buidDockerImage.sh
$ sh buildDockerImage.sh -h
//用法
Usage: buildDockerImage.sh -v [version] [-d | -g | -i] [-s]
Builds a Docker Image for Oracle WebLogic.
Parameters:
-v: version to build. Required.
Choose one of: 12.1.3 12.2.1, 12.2.1.1, 12.2.1.2, 12.2.1.3
-d: creates image based on 'developer' distribution
-g: creates image based on 'generic' distribution
-i: creates image based on 'infrastructure' distribution
-c: enables Docker image layer cache during build
-s: skips the MD5 check of packages
* select one distribution only: -d, -g, or -i
这时,Weblogic 镜像已经构建好了
[root@localhost dockerfiles]# docker images
REPOSITORY TAG IMAGE ID CREATED SIZE
12213-domain latest 404a21cbf05b 19 hours ago 1.42GB
oracle/weblogic 12.2.1.3-developer 0f666e38d7f3 19 hours ago 1.42GB
运行WebLogic容器
运行一个Administration Server:
$ docker run -d --name wlsadmin --hostname wlsadmin -p 7001:7001 --env-file ./container-scripts/domain.properties -e ADMIN_PASSWORD=<admin_password> -v <host directory>:/u01/oracle/user_projects 12213-domain
运行一个Managed Server(MS1):
$ docker run -d --name MS1 --link wlsadmin:wlsadmin -p 8001:8001 --env-file ./container-scripts/domain.properties -e ADMIN_PASSWORD=<admin_password> -e MS_NAME=MS1 --volumes-from wlsadmin 12213-domain createServer.sh
NOTE:当前用户需要对<host directory>目录有读/写权限;12.1.3版本缺少脚本无法添加MS。
ISSUE:使用12.2.1.3版本添加Managed Server时,出现https://github.com/oracle/docker-images/issues/750这个问题,需要将任意用户的UID和GID改成1000:1000:
$ useradd oracle
$ usermod -u 1000 oracle
$ usermod -g 1000 oracle
[root@localhost dockerfiles]# id oracle
uid=1000(oracle) gid=1000(root) groups=1000(root)
到此,相信大家对“如何使用docker部署WebLogic Server”有了更深的了解,不妨来实际操作一番吧!这里是天达云网站,更多相关内容可以进入相关频道进行查询,关注我们,继续学习!