-
Notifications
You must be signed in to change notification settings - Fork 5.4k
/
Copy pathDockerfile.xe
92 lines (84 loc) · 3.51 KB
/
Dockerfile.xe
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
# LICENSE UPL 1.0
#
# Copyright (c) 2016, 2020 Oracle and/or its affiliates.
#
# ORACLE DOCKERFILES PROJECT
# --------------------------
# This is the Dockerfile for Oracle Database 11g Release 2 Express Edition
#
# REQUIRED FILES TO BUILD THIS IMAGE
# ----------------------------------
# (1) oracle-xe-11.2.0-1.0.x86_64.rpm.zip
# Download Oracle Database 11g Release 2 Express Edition for Linux x64
# from http://www.oracle.com/technetwork/database/database-technologies/express-edition/downloads/index.html
#
# HOW TO BUILD THIS IMAGE
# -----------------------
# Put the downloaded file in the same directory as this Dockerfile
# Run:
# $ docker build -t oracle/database:11.2.0.2-xe .
#
# IMPORTANT
# ---------
# Oracle XE requires Docker 1.10.0 and above:
# Oracle XE uses shared memory for MEMORY_TARGET and needs at least 1 GB.
# Docker only supports --shm-size since Docker 1.10.0
#
# Pull base image
# ---------------
FROM oraclelinux:7-slim
# Labels
# ------
LABEL "provider"="Oracle" \
"issues"="https://github.com/oracle/docker-images/issues" \
"volume.data"="/u01/app/oracle/oradata" \
"volume.setup.location1"="/u01/app/oracle/scripts/startup" \
"volume.setup.location2"="/docker-entrypoint-initdb.d/setup" \
"volume.startup.location1"="/u01/app/oracle/scripts/setup" \
"volume.startup.location2"="/docker-entrypoint-initdb.d/startup" \
"port.listener"="1521" \
"port.apex"="8080"
# Environment variables required for this build (do NOT change)
# -------------------------------------------------------------
ENV ORACLE_BASE=/u01/app/oracle \
ORACLE_HOME=/u01/app/oracle/product/11.2.0/xe \
ORACLE_SID=XE \
INSTALL_FILE_1="oracle-xe-11.2.0-1.0.x86_64.rpm.zip" \
INSTALL_DIR="$HOME/install" \
CONFIG_RSP="xe.rsp" \
RUN_FILE="runOracle.sh" \
PWD_FILE="setPassword.sh" \
CHECK_DB_FILE="checkDBStatus.sh"
# Use second ENV so that variable get substituted
ENV PATH=$ORACLE_HOME/bin:$PATH
# Copy binaries
# -------------
COPY $INSTALL_FILE_1 $CONFIG_RSP $RUN_FILE $PWD_FILE $CHECK_DB_FILE $INSTALL_DIR/
# Install Oracle Express Edition
# ------------------------------
RUN yum -y install unzip libaio bc initscripts net-tools openssl compat-libstdc++-33 && \
rm -rf /var/cache/yum && \
cd $INSTALL_DIR && \
unzip $INSTALL_FILE_1 && \
rm $INSTALL_FILE_1 && \
cat() { declare -A PROC=(["/proc/sys/kernel/shmmax"]=4294967295 ["/proc/sys/kernel/shmmni"]=4096 ["/proc/sys/kernel/shmall"]=2097152 ["/proc/sys/fs/file-max"]=6815744); [[ ${PROC[$1]} == "" ]] && /usr/bin/cat $* || echo ${PROC[$1]}; } && \
free() { echo "Swap: 2048 0 2048"; } && \
export -f cat free && \
rpm -i Disk1/*.rpm && \
unset -f cat free && \
mkdir -p $ORACLE_BASE/scripts/setup && \
mkdir $ORACLE_BASE/scripts/startup && \
ln -s $ORACLE_BASE/scripts /docker-entrypoint-initdb.d && \
mkdir $ORACLE_BASE/oradata && \
chown -R oracle:dba $ORACLE_BASE && \
mv $INSTALL_DIR/$CONFIG_RSP $ORACLE_BASE/ && \
mv $INSTALL_DIR/$RUN_FILE $ORACLE_BASE/ && \
mv $INSTALL_DIR/$PWD_FILE $ORACLE_BASE/ && \
mv $INSTALL_DIR/$CHECK_DB_FILE $ORACLE_BASE/ && \
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