转载来源:https://hub.docker.com/r/sath89/oracle-12c/
使用Docker命令拉取oracle-12c镜像
docker pull sath89/oracle-12c
启动并暴露8080&1521端口,8080可以登录网页端管理,1521是数据连接端口:
docker run -d -p 8080:8080 -p 1521:1521 sath89/oracle-12c
启动并暴露8080&1521端口,并且挂载宿主机目录 /my/oracle/data 到oracle服务器/u01/app/oracle目录,这样database数据就保存在本地宿主机上:
docker run -d -p 8080:8080 -p 1521:1521 -v /my/oracle/data:/u01/app/oracle sath89/oracle-12c
启动并定制化DBCA总内存大小,DBCA_TOTAL_MEMORY (in Mb):
docker run -d -p 8080:8080 -p 1521:1521 -v /my/oracle/data:/u01/app/oracle -e DBCA_TOTAL_MEMORY=1024 sath89/oracle-12c
Orale服务器连接参数:
hostname: localhost
port: 1521
sid: xe
service name: xe
username: system
password: oracle
使用如下命令连接sqlplus:
sqlplus system/oracle@//localhost:1521/xe
Password for SYS & SYSTEM:
oracle
Oracle Web管理端连接参数:
http://localhost:8080/apex
workspace: INTERNAL
user: ADMIN
password: 0Racle$
Apex upgrade up to v 5. (配置Apex Oracle Application Express)*
docker run -it --rm --volumes-from ${DB_CONTAINER_NAME} --link ${DB_CONTAINER_NAME}:oracle-database -e PASS=YourSYSPASS sath89/apex install
Details could be found here: https://github.com/MaksymBilenko/docker-oracle-apex
Oracle Enterprise Management console (Oracle企业管理控制台):
http://localhost:8080/em
user: sys
password: oracle
connect as sysdba: true
配置环境变量参数,关闭Web CONSOLE:
docker run -d -e WEB_CONSOLE=false -p 1521:1521 -v /my/oracle/data:/u01/app/oracle sath89/oracle-12c
#You can Enable/Disable it on any time
启动Oracle,并加载初始化脚本:
docker run -d -p 1521:1521 -v /my/oracle/data:/u01/app/oracle -v /my/oracle/init/SCRIPTSorSQL:/docker-entrypoint-initdb.d sath89/oracle-12c
By default Import from docker-entrypoint-initdb.d
is enabled only if you are initializing database (1st run).
To customize dump import use IMPDP_OPTIONS
env variable like -e IMPDP_OPTIONS="REMAP_TABLESPACE=FOO:BAR"
To run import at any case add -e IMPORT_FROM_VOLUME=true
In case of using DMP imports dump file should be named like ${IMPORT_SCHEME_NAME}.dmp
User credentials for imports are ${IMPORT_SCHEME_NAME}/${IMPORT_SCHEME_NAME}
If you have an issue with database init like DBCA operation failed, please reffer to this issue
FROM sath89/oracle-12c-base
### This image is a build from non automated image cause of no possibility of Oracle 12c instalation in Docker container
ENV WEB_CONSOLE true
ENV DBCA_TOTAL_MEMORY 2048
ENV PATH /usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/u01/app/oracle/product/12.1.0/xe/bin
ENV USE_UTF8_IF_CHARSET_EMPTY true
ADD entrypoint.sh /entrypoint.sh
RUN apt-get update && apt-get -y install curl && apt-get clean && rm -rf /tmp/* /var/lib/apt/lists/* /var/tmp/*
EXPOSE 1521
EXPOSE 8080
VOLUME ["/docker-entrypoint-initdb.d"]
ENTRYPOINT ["/entrypoint.sh"]
CMD [""]
FROM sath89/docker-oracle-ee-12c-base:latest
ENV DBCA_TOTAL_MEMORY 4096
ENV WEB_CONSOLE true
ENV ORACLE_SID=EE
ENV ORACLE_HOME=/u01/app/oracle/product/12.2.0/EE
ENV PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/u01/app/oracle/product/12.2.0/EE/bin
ENV DISPLAY :0
ENV VNC_PASSWORD oracle
ENV MANUAL_DBCA false
RUN yum install -y epel-release && yum install -y xorg-x11-server-Xvfb x11vnc fluxbox xterm novnc && yum clean all
ADD entrypoint.sh /entrypoint.sh
EXPOSE 1521
EXPOSE 8080
EXPOSE 6800
VOLUME ["/docker-entrypoint-initdb.d"]
ENTRYPOINT ["/entrypoint.sh"]
CMD [""]
In case of any issues please post it here.
sath89/docker-oracle-ee-12c-base
This image is not ready to work. Cause of issues with Oracle 12c install on docker I'd have to do manual install on VM and transfer install files. Dockerfile with this build are available here: https://github.com/MaksymBilenko/docker-oracle-ee-12c/oracle-ee-12c-base
If you would like to use/fork this image you need to perform this steps to make it work:
chown -R oracle:dba /u01/app/oracle rm -f /u01/app/oracle/product ln -s /u01/app/oracle-product /u01/app/oracle/product
#Start tnslsnt su oracle -c "/u01/app/oracle/product/12.2.0/EE/bin/tnslsnr &"
#Create Database: su oracle -c "$ORACLE_HOME/bin/dbca -silent -createDatabase -templateName General_Purpose.dbc -gdbname xe.oracle.docker -sid xe -responseFile NO_VALUE -characterSet AL32UTF8 -totalMemory 512 -emConfiguration LOCAL -pdbAdminPassword oracle -sysPassword oracle -systemPassword oracle"
参考资料:https://hub.docker.com/r/sath89/oracle-ee-12c
参考资料:https://github.com/MaksymBilenko/docker-oracle-ee-12c/oracle-ee-12c-base