安装Docker

以root登录,运行

vi /etc/yum.repos.d/public-yum-ol6.repo,添加如下段落

[ol6_addons]
name=Oracle Linux $releasever Add ons ($basearch)
baseurl=http://public-yum.oracle.com/repo/OracleLinux/OL6/addons/$basearch/
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-oracle
gpgcheck=1
enabled=1

运行yum install docker

在运行过程中因为网络缓慢,可能出现退出情况,再运行一遍,如果遇到yum提示

another app is currently holding the yum lock;waiting for it to exit

可能是系统自动升级正在运行,yum在锁定状态中。
可以通过强制关掉yum进程:
#rm -f /var/run/yum.pid

完成后运行service start docker.

# chkconfig docker on

service docker status
docker (pid  9044) is running...

添加能直接运行docker权限的用户

# groupadd docker

# service docker restart

# usermod -a -G docker <your_user>

将git构建代码拿到本地

# yum install git

切换回weblogic用户,运行
$ git clone https://github.com/oracle/docker.git 如果网络比较慢的话再来一遍。
Build jre8 docker build -t oracle/serverjre:8 .

[weblogic@k8s-node-1 java-8]$ sudo docker build -t oracle/serverjre:8 .
Sending build context to Docker daemon 59.88 MB
Step 1 : FROM oraclelinux:7-slim
Trying to pull repository docker.io/library/oraclelinux ...
7-slim: Pulling from docker.io/library/oraclelinux
1f5b026b07bc: Pull complete
Digest: sha256:fdfc68d89f73172835cc2c715084b5a754cefa230b5012f7d2e8305f19acdce9
---> 442ebf722584
Step 2 : MAINTAINER Bruno Borges <bruno.borges@oracle.com>
---> Running in 2ee2b2aee1ce
---> 01dccda5f005
Removing intermediate container 2ee2b2aee1ce
Step 3 : ENV JAVA_PKG server-jre-8u*-linux-x64.tar.gz JAVA_HOME /usr/java/default
---> Running in 2e1ba8d77662
---> b92dfba19cd4
Removing intermediate container 2e1ba8d77662
Step 4 : ADD $JAVA_PKG /usr/java/
---> dd72812845da
Removing intermediate container 0419160026e2
Step 5 : RUN export JAVA_DIR=$(ls -1 -d /usr/java/*) && ln -s $JAVA_DIR /usr/java/latest && ln -s $JAVA_DIR /usr/java/default && alternatives --install /usr/bin/java java $JAVA_DIR/bin/java 20000 && alternatives --install /usr/bin/javac javac $JAVA_DIR/bin/javac 20000 && alternatives --install /usr/bin/jar jar $JAVA_DIR/bin/jar 20000
---> Running in bd4c197a5fb5
---> 8c0f2aaba6ed
Removing intermediate container bd4c197a5fb5
Successfully built 8c0f2aaba6ed


Build WebLogic Generic

进入../docker/OracleWebLogic/dockerfiles/12.1.3目录



下载相应的文件包括server-jre-8u73-linux-x64.tar.gz,fmw_12.1.3.0.0_wls.jar,wls1213_dev_update3.zip放入
通过xmanager的xftp. 运行$ sudo sh buildDockerImage.sh -g
-d主要采用_dev的包,构件开发环境。
-g采用generic的包,也就是fmw_12.1.3.0.0_wls.jar包,构建生产环境。
[weblogic@k8s-node-1 dockerfiles]$ sudo sh buildDockerImage.sh -g
Checking if required packages are present and valid...
fmw_12.1.3.0.0_wls.jar: OK
=====================
Building image 'oracle/weblogic:12.1.3-generic' ...
Sending build context to Docker daemon 923.2 MB
Step 1 : FROM oracle/serverjre:8
---> 8c0f2aaba6ed
Step 2 : MAINTAINER Bruno Borges <bruno.borges@oracle.com>
---> Running in a3be98df73be
---> d3832c5b38c1
Removing intermediate container a3be98df73be
Step 3 : ENV ORACLE_HOME /u01/oracle USER_MEM_ARGS "-Djava.security.egd=file:/dev/./urandom" PATH $PATH:/usr/java/default/bin:/u01/oracle/oracle_common/common/bin
---> Running in fb0773b87de2
---> 49ebdff9c0f2
Removing intermediate container fb0773b87de2
Step 4 : RUN mkdir -p /u01 && chmod a+xr /u01 && useradd -b /u01 -d /u01/oracle -m -s /bin/bash oracle && chown oracle:oracle -R /u01
---> Running in cb84a302230a
---> 81a0795cb544
Removing intermediate container cb84a302230a
Step 5 : ENV FMW_PKG fmw_12.1.3.0.0_wls.jar
---> Running in ba7ab1312206
---> ddb95b086113
Removing intermediate container ba7ab1312206
Step 6 : COPY $FMW_PKG install.file oraInst.loc /u01/
---> 95099fd96c30
Removing intermediate container 848ed94e0775
Step 7 : USER oracle
---> Running in e8a160c7caa1
---> 6e6dfc3527ee
Removing intermediate container e8a160c7caa1
Step 8 : RUN $JAVA_HOME/bin/java -jar /u01/$FMW_PKG -ignoreSysPrereqs -novalidation -silent -responseFile /u01/install.file -invPtrLoc /u01/oraInst.loc -jreLoc $JAVA_HOME ORACLE_HOME=$ORACLE_HOME INSTALL_TYPE="WebLogic Server" && rm /u01/$FMW_PKG /u01/oraInst.loc /u01/install.file
---> Running in 7e844f2f164b
Launcher log file is /tmp/OraInstall2017-05-08_01-43-40AM/launcher2017-05-08_01-43-40AM.log.
Extracting files.............
Starting Oracle Universal InstallerChecking if CPU speed is above 300 MHz. Actual 2494.162 MHz Passed
Checking swap space: must be greater than 512 MB. Actual 839676 MB Passed
Checking if this platform requires a 64-bit JVM. Actual 64 Passed (64-bit not required)
Checking temp space: must be greater than 300 MB. Actual 8146 MB Passed
Preparing to launch the Oracle Universal Installer from /tmp/OraInstall2017-05-08_01-43-40AM
Java HotSpot(TM) 64-Bit Server VM warning: ignoring option MaxPermSize=512m; support was removed in 8.0
Log: /tmp/OraInstall2017-05-08_01-43-40AM/install2017-05-08_01-43-40AM.log
Setting ORACLE_HOME to /u01/oracle
Setting INSTALL_TYPE to WebLogic Server
Copyright (c) 1996, 2014, Oracle and/or its affiliates. All rights reserved.
Reading response file..
Validations are disabled for this session.
Verifying data......
Copying Files...
You can find the log of this install session at:
/tmp/OraInstall2017-05-08_01-43-40AM/install2017-05-08_01-43-40AM.log
-----------20%----------40%----------60%----------80%--------100%The installation of Oracle Fusion Middleware 12c WebLogic Server and Coherence 12.1.3.0.0 completed successfully.
Logs successfully copied to /u01/oracle/.inventory/logs.
---> 7588fb8b1ea1
Removing intermediate container 7e844f2f164b
Step 9 : WORKDIR $ORACLE_HOME
---> Running in 2653c76fc994
---> fc3cfaae5e57
Removing intermediate container 2653c76fc994
Step 10 : CMD bash
---> Running in f4b21a3fb17b
---> 5d5e3db57694
Removing intermediate container f4b21a3fb17b
Successfully built 5d5e3db57694 WebLogic Docker Image for 'generic' version 12.1.3 is ready to be extended:

--> oracle/weblogic:12.1.3-generic Build completed in 210 seconds. 

如果sudo出错,解决办法:
以root用户修改/etc/sudoer 文件属性为root可修改,并在root ALL 行下添加 weblogic ALL(类似root行)
# chmod u+w sudoers 
# vi sudoers 
添加 weblogic    ALL=(ALL)    ALL 通过docker images查看本地的镜像 建立一个空域的weblogic container 进入sample目录下1213-domain目录,修改脚本,让上面的域基于generic来构件,然后运行 docker build -t 1213-domain . 或者是
sudo docker build -t 1213-domain --build-arg ADMIN_PASSWORD=welcome1 .

[weblogic@k8s-node-1 1213-domain]$ sudo docker build -t 1213-domain --build-arg ADMIN_PASSWORD=welcome1 .
Sending build context to Docker daemon 27.14 kB
Step 1 : FROM oracle/weblogic:12.1.3-generic
---> 5d5e3db57694
Step 2 : MAINTAINER Bruno Borges <bruno.borges@oracle.com>
---> Using cache
---> 0870893aeb94
Step 3 : ARG ADMIN_PASSWORD
---> Using cache
---> f96881560dd6
Step 4 : ARG PRODUCTION_MODE
---> Using cache
---> 71a8ea620d2f
Step 5 : ENV DOMAIN_NAME "base_domain" DOMAIN_HOME "/u01/oracle/user_projects/domains/base_domain" ADMIN_PORT "7001" ADMIN_HOST "wlsadmin" NM_PORT "5556" MS_PORT "7002" PRODUCTION_MODE "${PRODUCTION_MODE:-prod}" CONFIG_JVM_ARGS "-Dweblogic.security.SSL.ignoreHostnameVerification=true" PATH $PATH:/u01/oracle/oracle_common/common/bin:/u01/oracle/wlserver/common/bin:/u01/oracle/user_projects/domains/base_domain/bin:/u01/oracle
---> Using cache
---> a1a3b1491eb2
Step 6 : USER oracle
---> Using cache
---> 07a40e8318fb
Step 7 : COPY container-scripts/* /u01/oracle/
---> Using cache
---> 3fa0db902628
Step 8 : WORKDIR /u01/oracle
---> Using cache
---> 5456eb401629
Step 9 : RUN /u01/oracle/wlst /u01/oracle/create-wls-domain.py && mkdir -p /u01/oracle/user_projects/domains/base_domain/servers/AdminServer/security && echo "username=weblogic" > /u01/oracle/user_projects/domains/base_domain/servers/AdminServer/security/boot.properties && echo "password=$ADMIN_PASSWORD" >> /u01/oracle/user_projects/domains/base_domain/servers/AdminServer/security/boot.properties && echo ". /u01/oracle/user_projects/domains/base_domain/bin/setDomainEnv.sh" >> /u01/oracle/.bashrc && echo "export PATH=$PATH:/u01/oracle/wlserver/common/bin:/u01/oracle/user_projects/domains/base_domain/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
---> Running in 19bd5397ef26

Initializing WebLogic Scripting Tool (WLST) ...

Welcome to WebLogic Server Administration Scripting Shell

Type help() for help on available commands

domain_name : [base_domain]
admin_port : [7001]
cluster_name: [DockerCluster]
domain_path : [/u01/oracle/user_projects/domains/base_domain]
production_mode : [prod]

Exiting WebLogic Scripting Tool.

---> d35626c7b868
Removing intermediate container 19bd5397ef26
Step 10 : EXPOSE $NM_PORT $ADMIN_PORT $MS_PORT
---> Running in 12bb8b3bd00f
---> c9f2a9df2fc6
Removing intermediate container 12bb8b3bd00f
Step 11 : WORKDIR $DOMAIN_HOME
---> Running in 10935b7fde01
---> 6146bdb88ea7
Removing intermediate container 10935b7fde01
Step 12 : CMD startWebLogic.sh
---> Running in e1895ffb93af
---> 075e44ddb763
Removing intermediate container e1895ffb93af
Successfully built 075e44ddb763

运行容器

docker run -d 1213-domain

因为当前启动命令为startWebLogic.sh,所以通过logs可以看到weblogic启动日志.

此外还有另外两种启动方式:

docker run -d --name wlsadmin --hostname wlsadmin -p 8001:8001 1213-domain

docker run -d -p 8001:8001 --name=wlsadmin 1213-domain startWebLogic.sh

docker logs $container id

docker inspect <container_id> | grep "IPAddress"

然后运行http://172.17.0.1:8001/console,进入weblogic管理控制台(weblogic/welcome1)

修改容器,部署一个helloworld的应用,修改完commit

sudo docker commit -m "Added HelloWorld Application" -a "Eric Nie" 1a4f7376802f823ce71015a232b85810db17eec38ed54670d1ca06fb4f0e750e 1213-helloworld:v1

Docker实践2:安装Docker及weblogic镜像的更多相关文章

  1. Docker源码安装附内网镜像安装演示

    Docker源码安装附内网镜像安装演示 系统版本要求 当前系统版本:CentOS Linux release 7.9.2009 (Core) 内核版本:3.10.0-1160.el7.x86_64 注 ...

  2. Docker Alpine Dockerfile 安装nginx,最小镜像

    Docker Alpine Dockerfile 安装nginx,最小镜像 FROM alpine MAINTAINER will ## 将alpine-linux:apk的安装源改为国内镜像 RUN ...

  3. 【Docker】 CentOS7 安装 Docker 及其使用方法 ( 一 )

    系列目录: [Docker] CentOS7 安装 Docker 及其使用方法 ( 一 ) [Docker] 使用Docker 在阿里云 Centos7 部署 MySQL 和 Redis (二) [D ...

  4. Docker笔记--ubuntu安装docker

    Docker笔记--ubuntu安装docker 1.更换国内软件源,推荐中国科技大学的源,稳定速度快(可选) sudo cp /etc/apt/sources.list /etc/apt/sourc ...

  5. [Docker] Win10中安装Docker并运行Nginx镜像

    一.安装Docker 进入官网:https://www.docker.com/products/docker-desktop 可能需要先注册登录,很简单的. 点击 Download Desktop f ...

  6. Docker 入门及安装[Docker 系列-1]

    docker 如日中天,这不是单纯的炒概念,docker 确确实实解决了开发与运维的痛点,因此在企业开发中得到了非常广泛的使用,本文对于 docker 的这些基本知识点再做一些简单回顾. 什么是 do ...

  7. centos install docker setup centos7 安装docker

    centos7 安装docker 1: 安装必要的一些系统工具sudo yum install -y yum-utils device-mapper-persistent-data lvm2 2: 添 ...

  8. Ubuntu Server下docker实战 01: 安装docker

    本系列文章主旨在于使用docker来搭建实际可用的基础服务,具体到每一步的操作和设置. 关于docker的原理.前世今生的内容,园子里已经有太多的文章了,此处就不再赘述. 要使用docker,当然第一 ...

  9. Docker入门之安装Docker

    目录 目录 1 1. 前言 1 2. 创建网桥 2 3. 安装Docker 2 3.1. 二进制安装 3 3.1.1. 下载安装 3 3.1.2. 配置服务 3 3.1.3. 启动服务 4 3.2. ...

随机推荐

  1. tyvj1048 田忌赛马

    描述     中国古代的历史故事“田忌赛马”是为大家所熟知的.话说齐王和田忌又要赛马了,他们各派出N匹马,每场比赛,输的一方将要给赢的一方200两黄金,如果是平局的话,双方都不必拿出钱.现在每匹马的速 ...

  2. The Clean Architecture--一篇很不错的关于架构的文章

    翻译水平有限,见谅! Uncle Bob 13 Aug 2012 Architecture Craftsmanship Over the last several years we’ve seen a ...

  3. 【反演复习计划】【bzoj3994】DZY loves maths

    这题大概就是提取一下d,然后就跟前面的题目差不多了. #include<bits/stdc++.h> #define N 10000005 using namespace std; typ ...

  4. 使用System.getProperty("line.separator")时没有换行问题解决

    项目中要实现替换模版txt文本里面的内容,然后生成新的文档,其中先把模版文本的内容通过创建的 BufferedReader bufReader 使用 readLine() 来一行一行读取,所以在完成替 ...

  5. request.getRequestDispatcher(url).forward(request, response)

    request.getRequestDispatcher().forward(request, response) 意思是将客户端的请求转向到 getRequestDispatcher()方法中参数定 ...

  6. SQLAlchemy技术文档(中文版)-上

    转自:http://www.cnblogs.com/iwangzc/p/4112078.html 1.版本检查 import sqlalchemy sqlalchemy.__version__ 2.连 ...

  7. 前段基础JavaScript

    JavaScript概述 JavaScript的历史 1992年Nombas开发出C-minus-minus(C--)的嵌入式脚本语言(最初绑定在CEnvi软件中).后将其改名ScriptEase.( ...

  8. 自动监控tomcat脚本并且执行重启操作

    #!/bin/sh # func:自动监控tomcat脚本并且执行重启操作 # author:reed # date:// # 定义环境变量 MYPATH=/usr/local/jdk/bin exp ...

  9. Iphone安装Pinterest

    由于Pinterest在中国的app store下架了,也就搜索不到该应用.所以只能上美国的app store下载. 1,下载itunes,登录vpn,注册新的apple id: 2,手机连接vpn, ...

  10. mysql数据库设计之三范式

    第一范式: 第二范式:   正解: 第三范式: 示例: 正解: BC范式: 示例: 正解: