1. 下载oracle-12.2.0.1的安装包并上传到服务器上。
  2. github下载文件并上传到服务器上
    注意:安装文件包要放到dockerfile/12.2.0.1目录中
  3. build oracle-docker镜像
./buildDockerImage.sh -v 12.2.0.1 -e -i

Usage: buildDockerImage.sh -v [version] [-e | -s | -x] [-i] [-o] [Docker build option]
Builds a Docker Image for Oracle Database.

Parameters:
   -v: version to build
       Choose one of: 11.2.0.2  12.1.0.2  12.2.0.1
   -e: creates image based on 'Enterprise Edition'
   -s: creates image based on 'Standard Edition 2'
   -x: creates image based on 'Express Edition'
   -i: ignores the MD5 checksums
   -o: passes on Docker build option

* select one edition only: -e, -s, or -x
  1. 运行镜像
    应该先设置一下主机上用来存放数据的目录权限:
    chmod 777 -R /vdb1/db/docker-oracle-data/
    要不然启动容器时创建数据库会提示权限不足。
docker run --name oracle12c \
-p 1521:1521 -p 5500:5500 \
-v  /vdb1/db/docker-oracle-data:/opt/oracle/oradata \
oracle/database:12.2.0.1-ee

原来oracle12c里新出一个CDB和PDB的概念,允许一个数据库容器(CDB)承载多个可插拔数据库(PDB)。
docker exec oracle/database:12.2.0.1-ee ./setPassword.sh <your password>

docker run --name <container name> \
-p 1521:1521 -p 5500:5500 \
-e ORACLE_CHARACTERSET=<your character set> \
-v [<host mount point>:]/opt/oracle/oradata \
oracle/database:12.2.0.1-ee

Parameters:
   --name:        The name of the container (default: auto generated)
   -p:            The port mapping of the host port to the container port. 
                  Two ports are exposed: 1521 (Oracle Listener), 5500 (OEM Express)
   -e ORACLE_SID: The Oracle Database SID that should be used (default: ORCLCDB)
   -e ORACLE_PDB: The Oracle Database PDB name that should be used (default: ORCLPDB1)
   -e ORACLE_PWD: The Oracle Database SYS, SYSTEM and PDB_ADMIN password (default: auto generated)
   -e ORACLE_CHARACTERSET:
                  The character set to use when creating the database (default: AL32UTF8)
   -v /opt/oracle/oradata
                  The data volume to use for the database.
                  Has to be writable by the Unix "oracle" (uid: 54321) user inside the container!
                  If omitted the database will not be persisted over container recreation.
   -v /opt/oracle/scripts/startup | /docker-entrypoint-initdb.d/startup
                  Optional: A volume with custom scripts to be run after database startup.
                  For further details see the "Running scripts after setup and on startup" section below.
   -v /opt/oracle/scripts/setup | /docker-entrypoint-initdb.d/setup
                  Optional: A volume with custom scripts to be run after database setup.
                  For further details see the "Running scripts after setup and on startup" section below.

 

作者:潘祖龙
链接:https://www.jianshu.com/p/3dcc43640c3a
來源:简书
简书著作权归作者所有,任何形式的转载都请联系作者获得授权并注明出处。

MariaDB Galera Cluster 部署(如何快速部署 MariaDB 集群)

MariaDB 作为 Mysql 的一个分支,在开源项目中已经广泛使用,例如大热的 openstack,所以,为了保证服务的高可用性,同时提高系统的负载能力,集群部署是必...

阅读全文

修改使用Alpine Linux的Docker容器的时区

适用对象 使用 Alpine Linux 发行版的 Docker 镜像容器。仅仅适用于没有安装uclibc的系统。 修改步骤 进入容器命令行 # docker exec -it contain...

阅读全文

CentOS下shadowsocks-libev一键安装脚本

本脚本适用环境: 系统支持:CentOS 内存要求:≥128M 日期:2018 年 06 月 01 日 关于本脚本: 一键安装 libev 版的 Shadowsocks 最新版本。该版本的特点...

阅读全文

欢迎留言