/
Dockerfile
83 lines (75 loc) · 3.04 KB
/
Dockerfile
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
# LICENSE CDDL 1.0 + GPL 2.0
#
# Copyright (c) 1982-2016 Oracle and/or its affiliates. All rights reserved.
#
# 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:latest
# 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"
# 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 $INSTALL_DIR/
# Install Oracle Express Edition
# ------------------------------
RUN yum -y install unzip libaio bc initscripts net-tools openssl && \
yum clean all && \
cd $INSTALL_DIR && \
unzip $INSTALL_FILE_1 && \
rm $INSTALL_FILE_1 && \
rpm -i Disk1/*.rpm && \
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/ && \
ln -s $ORACLE_BASE/$PWD_FILE / && \
cd $HOME && \
rm -rf $INSTALL_DIR && \
chmod u+x $ORACLE_BASE/$RUN_FILE && \
chmod u+x $ORACLE_BASE/$PWD_FILE
RUN touch /etc/profile.d/oracle_profile.sh && \
echo 'export PATH=$PATH' >> /etc/profile.d/oracle_profile.sh && \
echo 'export ORACLE_BASE=$ORACLE_BASE' >> /etc/profile.d/oracle_profile.sh && \
echo 'export ORACLE_HOME=$ORACLE_HOME' >> /etc/profile.d/oracle_profile.sh && \
echo 'export ORACLE_SID=$ORACLE_SID' >> /etc/profile.d/oracle_profile.sh && \
echo 'export INSTALL_FILE_1=$INSTALL_FILE_1' >> /etc/profile.d/oracle_profile.sh && \
echo 'export INSTALL_DIR=$INSTALL_DIR' >> /etc/profile.d/oracle_profile.sh && \
echo 'export CONFIG_RSP=$CONFIG_RSP' >> /etc/profile.d/oracle_profile.sh && \
echo 'export RUN_FILE=$RUN_FILE' >> /etc/profile.d/oracle_profile.sh && \
echo 'export PWD_FILE=$PWD_FILE' >> /etc/profile.d/oracle_profile.sh
VOLUME ["$ORACLE_BASE/oradata"]
EXPOSE 1521 8090
CMD $ORACLE_BASE/$RUN_FILE