Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Script to create Oracle slim images for all versions #1666

Open
wants to merge 38 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
38 commits
Select commit Hold shift + click to select a range
2dd4a33
Docker scripts files for building 18.0.0.0 RDBMS image
Mar 24, 2018
6dc62ca
fixed listener registration after stop/start container
Apr 11, 2018
ce152f2
Merge remote-tracking branch 'upstream/master'
Aug 19, 2018
935fee3
initial scripts for build 18c-xe docker image
Oct 22, 2018
50ba51e
removed previous build scripts using exadata binary download
Oct 22, 2018
5f81ecf
created oracle user home
Oct 23, 2018
d347ad9
Update OracleDatabase/SingleInstance/dockerfiles/18.4.0/runOracle.sh
gvenzl Nov 8, 2018
9c8bb56
removed /etc/sysconfig/oracle-xe-18c.conf from dbconfig dir
Nov 8, 2018
ddf7d91
Merge remote-tracking branch 'upstream/master'
Nov 9, 2018
ba382e7
change requested by gerald
Nov 13, 2018
aed988b
use checkDBStatus from 18.3.0 version
Nov 13, 2018
ea3cbd5
use checkDBStatus from 18.0.3 version
Nov 13, 2018
ecbc1c3
fixed file name mapping for 18.4.0 xe Dockerfile
Nov 15, 2018
8f226ea
fixed checkDBStatus.sh scripts with XE image
Nov 20, 2018
3b2c359
Merge remote-tracking branch 'upstream/master'
Nov 20, 2018
36c1567
added missing ] in if check
Nov 23, 2018
0cc0460
Initial build scripts for 19c
Feb 14, 2019
5e37356
merge with base
Apr 26, 2019
b0021fc
Merge remote-tracking branch 'upstream/master'
Apr 27, 2019
bffc5a5
Sample Dockerfiles for using Multipath NFS storage
Apr 27, 2019
e85c174
Merge remote-tracking branch 'upstream/master'
marcelo-ochoa Feb 21, 2020
91824c2
removed comment
marcelo-ochoa Feb 21, 2020
4ce12f3
fixed merged comments
marcelo-ochoa Feb 21, 2020
7319763
layerd version of Dockerfile.xe
marcelo-ochoa Feb 22, 2020
c6998d1
initial impl. multi-layered image, around 1/3 original image
marcelo-ochoa Feb 24, 2020
87c4f2e
initial impl. multi-stage image
marcelo-ochoa Feb 24, 2020
88beb65
added missing link
marcelo-ochoa Feb 24, 2020
33058d6
support for format init-db.tar, init-db.tar.gz and rman compressed ba…
marcelo-ochoa Feb 24, 2020
8ec2574
renamed docker image slim files
marcelo-ochoa Feb 26, 2020
5bdfb53
removed obsoleted build for 19.2
marcelo-ochoa Feb 26, 2020
fee7759
merged with production version of 18.4 XE
marcelo-ochoa Feb 26, 2020
79c59b9
Delete Dockerfile.nfs
marcelo-ochoa Feb 26, 2020
d5cb5e6
Delete Dockerfile.nfs
marcelo-ochoa Feb 26, 2020
7f8b5a6
Delete Dockerfile.nfs
marcelo-ochoa Feb 26, 2020
efd10c0
Merge https://github.com/oracle/docker-images
Jul 11, 2020
60c9706
slim images for all versions
Jul 22, 2020
3a2f840
buildImages.sh script with -l flag
Jul 22, 2020
3bd6d14
rename build script
Feb 24, 2021
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Next Next commit
Docker scripts files for building 18.0.0.0 RDBMS image
  • Loading branch information
Marcelo Ochoa committed Mar 24, 2018
commit 2dd4a3318dde40f8a1f6764f4e092720ae29843e
1 change: 1 addition & 0 deletions OracleDatabase/dockerfiles/18.0.0.0/Checksum.ee
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
d9bdce823cd73a220aea3bf4fed4ea16 V974953-01.zip
92 changes: 92 additions & 0 deletions OracleDatabase/dockerfiles/18.0.0.0/Dockerfile.ee
Original file line number Diff line number Diff line change
@@ -0,0 +1,92 @@
# LICENSE UPL 1.0
#
# Copyright (c) 1982-2017 Oracle and/or its affiliates. All rights reserved.
#
# ORACLE DOCKERFILES PROJECT
# --------------------------
# This is the Dockerfile for Oracle Database 12c Release 2 Enterprise Edition
#
# REQUIRED FILES TO BUILD THIS IMAGE
# ----------------------------------
# (1) linuxx64_12201_database.zip
# Download Oracle Database 12c Release 12 Enterprise Edition for Linux x64
# from http://www.oracle.com/technetwork/database/enterprise-edition/downloads/index.html
#
# HOW TO BUILD THIS IMAGE
# -----------------------
# Put all downloaded files in the same directory as this Dockerfile
# Run:
# $ docker build -t oracle/database:12.2.0.1-ee .
#
# Pull base image
# ---------------
FROM oraclelinux:7-slim

# Maintainer
# ----------
MAINTAINER Gerald Venzl <gerald.venzl@oracle.com>

# Environment variables required for this build (do NOT change)
# -------------------------------------------------------------
ENV ORACLE_BASE=/scratch/app/user \
ORACLE_HOME=/scratch/app/user/product/18.0.0/dbhome_1 \
INSTALL_FILE_1="V974953-01.zip" \
INSTALL_RSP="db_inst.rsp" \
CONFIG_RSP="dbca.rsp.tmpl" \
PWD_FILE="setPassword.sh" \
RUN_FILE="runOracle.sh" \
START_FILE="startDB.sh" \
CREATE_DB_FILE="createDB.sh" \
SETUP_LINUX_FILE="setupLinuxEnv.sh" \
CHECK_SPACE_FILE="checkSpace.sh" \
CHECK_DB_FILE="checkDBStatus.sh" \
USER_SCRIPTS_FILE="runUserScripts.sh" \
INSTALL_DB_BINARIES_FILE="installDBBinaries.sh"

# Use second ENV so that variable get substituted
ENV INSTALL_DIR=$ORACLE_BASE/install \
PATH=$ORACLE_HOME/bin:$ORACLE_HOME/OPatch/:/usr/sbin:$PATH \
LD_LIBRARY_PATH=$ORACLE_HOME/lib:/usr/lib \
CLASSPATH=$ORACLE_HOME/jlib:$ORACLE_HOME/rdbms/jlib

# Copy binaries
# -------------
COPY $INSTALL_FILE_1 $INSTALL_RSP $SETUP_LINUX_FILE $CHECK_SPACE_FILE $INSTALL_DB_BINARIES_FILE $INSTALL_DIR/
COPY $RUN_FILE $START_FILE $CREATE_DB_FILE $CONFIG_RSP $PWD_FILE $CHECK_DB_FILE $USER_SCRIPTS_FILE $ORACLE_BASE/

RUN chmod ug+x $INSTALL_DIR/*.sh && \
sync && \
$INSTALL_DIR/$CHECK_SPACE_FILE && \
$INSTALL_DIR/$SETUP_LINUX_FILE

# Install DB software binaries
USER oracle
RUN $INSTALL_DIR/$INSTALL_DB_BINARIES_FILE EE

USER root
RUN sed -i -e "s|ORACLE_OWNER=user|ORACLE_OWNER=oracle|g" $ORACLE_HOME/install/utl/rootmacro.sh && \
sed -i -e "s|OSDBA_GROUP=svrtech|OSDBA_GROUP=dba|g" $ORACLE_HOME/install/utl/rootmacro.sh && \
$ORACLE_HOME/root.sh && \
rm -rf $INSTALL_DIR

USER oracle
# install wrapper to avoid exadata check environment
COPY libexadata_wrap.so ldflags exadata_wrap.c $ORACLE_HOME/lib/

# fix lsnrctl and others binary files with size 0 and relink with wrapper function
RUN cd $ORACLE_HOME/network/lib && make -f ins_net_server.mk install && \
cd $ORACLE_HOME/network/lib && make -f ins_net_client.mk install && \
cd $ORACLE_HOME/plsql/lib && make -f ins_plsql.mk install && \
cd $ORACLE_HOME/ctx/lib && make -f ins_ctx.mk install && \
cd $ORACLE_HOME/rdbms/lib && make -f ins_rdbms.mk install && \
make -f ins_rdbms.mk irman itkprof iplshprof iextproc idrdactl idrdalsnr idrdaproc idg4pwd idg4odbc

WORKDIR /home/oracle

VOLUME ["$ORACLE_BASE/oradata"]
EXPOSE 1521 5500
HEALTHCHECK --interval=1m --start-period=5m \
CMD "$ORACLE_BASE/$CHECK_DB_FILE" >/dev/null || exit 1

# Define default command to start Oracle Database.
CMD exec $ORACLE_BASE/$RUN_FILE
40 changes: 40 additions & 0 deletions OracleDatabase/dockerfiles/18.0.0.0/checkDBStatus.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
#!/bin/bash
# LICENSE UPL 1.0
#
# Copyright (c) 1982-2017 Oracle and/or its affiliates. All rights reserved.
#
# Since: May, 2017
# Author: gerald.venzl@oracle.com
# Description: Checks the status of Oracle Database.
# Return codes: 0 = Database is open and ready to use
# 1 = Database is not open
# 2 = Sql Plus execution failed
# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
#

ORACLE_SID="`grep $ORACLE_HOME /etc/oratab | cut -d: -f1`"
ORACLE_PDB="`ls -dl $ORACLE_BASE/oradata/$ORACLE_SID/*/ | grep -v pdbseed | awk '{print $9}' | cut -d/ -f6`"
ORAENV_ASK=NO
source oraenv

# Check Oracle DB status and store it in status
status=`sqlplus -s / as sysdba << EOF
set heading off;
set pagesize 0;
select status from v\\$instance;
exit;
EOF`

# Store return code from SQL*Plus
ret=$?

# SQL Plus execution was successful and database is open
if [ $ret -eq 0 ] && [ "$status" = "OPEN" ]; then
exit 0;
# Database is not open
elif [ "$status" != "OPEN" ]; then
exit 1;
# SQL Plus execution failed
else
exit 2;
fi;
23 changes: 23 additions & 0 deletions OracleDatabase/dockerfiles/18.0.0.0/checkSpace.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
#!/bin/bash
# LICENSE UPL 1.0
#
# Copyright (c) 1982-2017 Oracle and/or its affiliates. All rights reserved.
#
# Since: January, 2017
# Author: gerald.venzl@oracle.com
# Description: Checks the available space of the system.
#
# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
#

REQUIRED_SPACE_GB=15
AVAILABLE_SPACE_GB=`df -B 1G / | tail -n 1 | awk '{ print $4 }'`

if [ $AVAILABLE_SPACE_GB -lt $REQUIRED_SPACE_GB ]; then
script_name=`basename "$0"`
echo "!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!"
echo "$script_name: ERROR - There is not enough space available in the docker container."
echo "$script_name: The container needs at least $REQUIRED_SPACE_GB GB, but only $AVAILABLE_SPACE_GB GB are available."
echo "!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!"
exit 1;
fi;
85 changes: 85 additions & 0 deletions OracleDatabase/dockerfiles/18.0.0.0/createDB.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,85 @@
#!/bin/bash
# LICENSE UPL 1.0
#
# Copyright (c) 1982-2016 Oracle and/or its affiliates. All rights reserved.
#
# Since: November, 2016
# Author: gerald.venzl@oracle.com
# Description: Creates an Oracle Database based on following parameters:
# $ORACLE_SID: The Oracle SID and CDB name
# $ORACLE_PDB: The PDB name
# $ORACLE_PWD: The Oracle password
#
# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
#

set -e

# Check whether ORACLE_SID is passed on
export ORACLE_SID=${1:-ORCLCDB}

# Check whether ORACLE_PDB is passed on
export ORACLE_PDB=${2:-ORCLPDB1}

# Auto generate ORACLE PWD if not passed on
export ORACLE_PWD=${3:-"`openssl rand -base64 8`1"}
echo "ORACLE PASSWORD FOR SYS, SYSTEM AND PDBADMIN: $ORACLE_PWD";

# Replace place holders in response file
cp $ORACLE_BASE/$CONFIG_RSP $ORACLE_BASE/dbca.rsp
sed -i -e "s|###ORACLE_SID###|$ORACLE_SID|g" $ORACLE_BASE/dbca.rsp
sed -i -e "s|###ORACLE_PDB###|$ORACLE_PDB|g" $ORACLE_BASE/dbca.rsp
sed -i -e "s|###ORACLE_PWD###|$ORACLE_PWD|g" $ORACLE_BASE/dbca.rsp
sed -i -e "s|###ORACLE_CHARACTERSET###|$ORACLE_CHARACTERSET|g" $ORACLE_BASE/dbca.rsp

# If there is greater than 8 CPUs default back to dbca memory calculations
# dbca will automatically pick 40% of available memory for Oracle DB
# The minimum of 2G is for small environments to guarantee that Oracle has enough memory to function
# However, bigger environment can and should use more of the available memory
# This is due to Github Issue #307
if [ `nproc` -gt 8 ]; then
sed -i -e "s|totalMemory=2048||g" $ORACLE_BASE/dbca.rsp
fi;

# Create network related config files (sqlnet.ora, tnsnames.ora, listener.ora)
mkdir -p $ORACLE_HOME/network/admin
echo "NAME.DIRECTORY_PATH= (TNSNAMES, EZCONNECT, HOSTNAME)" > $ORACLE_HOME/network/admin/sqlnet.ora

# Listener.ora
echo "LISTENER =
(DESCRIPTION_LIST =
(DESCRIPTION =
(ADDRESS = (PROTOCOL = IPC)(KEY = EXTPROC1))
(ADDRESS = (PROTOCOL = TCP)(HOST = 0.0.0.0)(PORT = 1521))
)
)

DEDICATED_THROUGH_BROKER_LISTENER=ON
DIAG_ADR_ENABLED = off
" > $ORACLE_HOME/network/admin/listener.ora

# Start LISTENER and run DBCA
lsnrctl start &&
dbca -silent -createDatabase -responseFile $ORACLE_BASE/dbca.rsp ||
cat /scratch/app/user/cfgtoollogs/dbca/$ORACLE_SID/$ORACLE_SID.log ||
cat /scratch/app/user/cfgtoollogs/dbca/$ORACLE_SID.log

echo "$ORACLE_SID=localhost:1521/$ORACLE_SID" > $ORACLE_HOME/network/admin/tnsnames.ora
echo "$ORACLE_PDB=
(DESCRIPTION =
(ADDRESS = (PROTOCOL = TCP)(HOST = 0.0.0.0)(PORT = 1521))
(CONNECT_DATA =
(SERVER = DEDICATED)
(SERVICE_NAME = $ORACLE_PDB)
)
)" >> $ORACLE_HOME/network/admin/tnsnames.ora

# Remove second control file, make PDB auto open
sqlplus / as sysdba << EOF
ALTER SYSTEM SET control_files='$ORACLE_BASE/oradata/$ORACLE_SID/control01.ctl' scope=spfile;
ALTER PLUGGABLE DATABASE $ORACLE_PDB SAVE STATE;
exit;
EOF

# Remove temporary response file
rm $ORACLE_BASE/dbca.rsp
125 changes: 125 additions & 0 deletions OracleDatabase/dockerfiles/18.0.0.0/db_inst.rsp
Original file line number Diff line number Diff line change
@@ -0,0 +1,125 @@
####################################################################
## Copyright(c) Oracle Corporation 1998,2017. All rights reserved.##
## ##
## Specify values for the variables listed below to customize ##
## your installation. ##
## ##
## Each variable is associated with a comment. The comment ##
## can help to populate the variables with the appropriate ##
## values. ##
## ##
## IMPORTANT NOTE: This file contains plain text passwords and ##
## should be secured to have read permission only by oracle user ##
## or db administrator who owns this installation. ##
## ##
####################################################################


#-------------------------------------------------------------------------------
# Do not change the following system generated value.
#-------------------------------------------------------------------------------
oracle.install.responseFileVersion=/oracle/install/rspfmt_dbinstall_response_schema_v12.2.0

#-------------------------------------------------------------------------------
# Specify the installation option.
# It can be one of the following:
# - INSTALL_DB_SWONLY
# - INSTALL_DB_AND_CONFIG
# - UPGRADE_DB
#-------------------------------------------------------------------------------
oracle.install.option=INSTALL_DB_SWONLY

#-------------------------------------------------------------------------------
# Specify the Unix group to be set for the inventory directory.
#-------------------------------------------------------------------------------
UNIX_GROUP_NAME=dba

#-------------------------------------------------------------------------------
# Specify the location which holds the inventory files.
# This is an optional parameter if installing on
# Windows based Operating System.
#-------------------------------------------------------------------------------
INVENTORY_LOCATION=###ORACLE_BASE###/oraInventory
#-------------------------------------------------------------------------------
# Specify the complete path of the Oracle Home.
#-------------------------------------------------------------------------------
ORACLE_HOME=###ORACLE_HOME###

#-------------------------------------------------------------------------------
# Specify the complete path of the Oracle Base.
#-------------------------------------------------------------------------------
ORACLE_BASE=###ORACLE_BASE###

#-------------------------------------------------------------------------------
# Specify the installation edition of the component.
#
# The value should contain only one of these choices.
# - EE : Enterprise Edition
# - SE2 : Standard Edition 2
#-------------------------------------------------------------------------------
oracle.install.db.InstallEdition=###ORACLE_EDITION###

###############################################################################
# #
# PRIVILEGED OPERATING SYSTEM GROUPS #
# ------------------------------------------ #
# Provide values for the OS groups to which SYSDBA and SYSOPER privileges #
# needs to be granted. If the install is being performed as a member of the #
# group "dba", then that will be used unless specified otherwise below. #
# #
# The value to be specified for OSDBA and OSOPER group is only for UNIX based #
# Operating System. #
# #
###############################################################################

#------------------------------------------------------------------------------
# The OSDBA_GROUP is the OS group which is to be granted SYSDBA privileges.
#-------------------------------------------------------------------------------
oracle.install.db.OSDBA_GROUP=dba

#------------------------------------------------------------------------------
# The OSOPER_GROUP is the OS group which is to be granted SYSOPER privileges.
# The value to be specified for OSOPER group is optional.
#------------------------------------------------------------------------------
oracle.install.db.OSOPER_GROUP=dba

#------------------------------------------------------------------------------
# The OSBACKUPDBA_GROUP is the OS group which is to be granted SYSBACKUP privileges.
#------------------------------------------------------------------------------
oracle.install.db.OSBACKUPDBA_GROUP=dba

#------------------------------------------------------------------------------
# The OSDGDBA_GROUP is the OS group which is to be granted SYSDG privileges.
#------------------------------------------------------------------------------
oracle.install.db.OSDGDBA_GROUP=dba

#------------------------------------------------------------------------------
# The OSKMDBA_GROUP is the OS group which is to be granted SYSKM privileges.
#------------------------------------------------------------------------------
oracle.install.db.OSKMDBA_GROUP=dba

#------------------------------------------------------------------------------
# The OSRACDBA_GROUP is the OS group which is to be granted SYSRAC privileges.
#------------------------------------------------------------------------------
oracle.install.db.OSRACDBA_GROUP=dba

#------------------------------------------------------------------------------
# Specify whether to enable the user to set the password for
# My Oracle Support credentials. The value can be either true or false.
# If left blank it will be assumed to be false.
#
# Example : SECURITY_UPDATES_VIA_MYORACLESUPPORT=true
#------------------------------------------------------------------------------
SECURITY_UPDATES_VIA_MYORACLESUPPORT=false

#------------------------------------------------------------------------------
# Specify whether user doesn't want to configure Security Updates.
# The value for this variable should be true if you don't want to configure
# Security Updates, false otherwise.
#
# The value can be either true or false. If left blank it will be assumed
# to be true.
#
# Example : DECLINE_SECURITY_UPDATES=false
#------------------------------------------------------------------------------
DECLINE_SECURITY_UPDATES=true
Loading