Skip to content

Instantly share code, notes, and snippets.

@hantsy
Created August 14, 2020 08:58
Show Gist options
  • Save hantsy/57ed22ea775763ceceaebaa01182592b to your computer and use it in GitHub Desktop.
Save hantsy/57ed22ea775763ceceaebaa01182592b to your computer and use it in GitHub Desktop.
A modified dockerfile.xe to install oracle database 18.4.0 from local disc.
# LICENSE UPL 1.0
#
# Copyright (c) 2018, 2020 Oracle and/or its affiliates.
#
# ORACLE DOCKERFILES PROJECT
# --------------------------
# This is the Dockerfile for Oracle Database 18c Express Edition
#
# REQUIRED FILES TO BUILD THIS IMAGE
# ----------------------------------
# None
#
# HOW TO BUILD THIS IMAGE
# -----------------------
# Run:
# $ docker build -t oracle/database:18.4.0-xe -f Dockerfile.xe .
#
#
# Pull base image
# ---------------
FROM oraclelinux:7-slim
# Labels
# ------
LABEL "provider"="Oracle" \
"issues"="https://github.com/oracle/docker-images/issues" \
"volume.data"="/opt/oracle/oradata" \
"volume.setup.location1"="/opt/oracle/scripts/setup" \
"volume.setup.location2"="/docker-entrypoint-initdb.d/setup" \
"volume.startup.location1"="/opt/oracle/scripts/startup" \
"volume.startup.location2"="/docker-entrypoint-initdb.d/startup" \
"port.listener"="1521" \
"port.oemexpress"="5500" \
"port.apex"="8080"
# Environment variables required for this build (do NOT change)
# -------------------------------------------------------------
ENV ORACLE_BASE=/opt/oracle \
ORACLE_HOME=/opt/oracle/product/18c/dbhomeXE \
ORACLE_SID=XE \
INSTALL_FILE_1="oracle-database-xe-18c-1.0-1.x86_64.rpm" \
# INSTALL_FILE_1="https://download.oracle.com/otn-pub/otn_software/db-express/oracle-database-xe-18c-1.0-1.x86_64.rpm" \
RUN_FILE="runOracle.sh" \
PWD_FILE="setPassword.sh" \
CONF_FILE="oracle-xe-18c.conf" \
CHECK_SPACE_FILE="checkSpace.sh" \
CHECK_DB_FILE="checkDBStatus.sh" \
INSTALL_DIR="$HOME/install" \
ORACLE_DOCKER_INSTALL="true"
# Use second ENV so that variable get substituted
ENV PATH=$ORACLE_HOME/bin:$PATH
# Copy binaries
# -------------
COPY $CHECK_SPACE_FILE $RUN_FILE $PWD_FILE $CHECK_DB_FILE $CONF_FILE $INSTALL_FILE_1 $INSTALL_DIR/
RUN chmod ug+x $INSTALL_DIR/*.sh && \
sync && \
$INSTALL_DIR/$CHECK_SPACE_FILE && \
cd $INSTALL_DIR && \
yum -y install file openssl oracle-database-preinstall-18c && \
yum -y localinstall ./$INSTALL_FILE_1 && \
rm -rf /var/cache/yum && \
rm -rf /var/tmp/yum-* && \
mkdir -p $ORACLE_BASE/scripts/setup && \
mkdir $ORACLE_BASE/scripts/startup && \
ln -s $ORACLE_BASE/scripts /docker-entrypoint-initdb.d && \
mkdir -p $ORACLE_BASE/oradata /home/oracle && \
chown -R oracle:oinstall $ORACLE_BASE /home/oracle && \
mv $INSTALL_DIR/$RUN_FILE $ORACLE_BASE/ && \
mv $INSTALL_DIR/$PWD_FILE $ORACLE_BASE/ && \
mv $INSTALL_DIR/$CHECK_DB_FILE $ORACLE_BASE/ && \
mv $INSTALL_DIR/$CONF_FILE /etc/sysconfig/ && \
ln -s $ORACLE_BASE/$PWD_FILE / && \
cd $HOME && \
rm -rf $INSTALL_DIR && \
chmod ug+x $ORACLE_BASE/*.sh
HEALTHCHECK --interval=1m --start-period=5m \
CMD "$ORACLE_BASE/$CHECK_DB_FILE" >/dev/null || exit 1
CMD exec $ORACLE_BASE/$RUN_FILE
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment