Skip to content

Instantly share code, notes, and snippets.

@driedtoast
Last active April 13, 2017 17:21
Show Gist options
  • Save driedtoast/ce276ebd8fe9d59754cd07c8a0dc4a5f to your computer and use it in GitHub Desktop.
Save driedtoast/ce276ebd8fe9d59754cd07c8a0dc4a5f to your computer and use it in GitHub Desktop.
Oracle XE on Docker
FROM oracle/database:11.2.0.2-xe
ENV NEW_ORACLE_PWD oracle
ENV ORACLE_PWD $NEW_ORACLE_PWD
ENV ORACLE_SID XE
ENV ORACLE_PDB $ORACLE_SID
COPY setup-script.sql $ORACLE_BASE/
RUN sed -i "s|echo \"ORACLE AUTO|ORACLE_PWD=$NEW_ORACLE_PWD; echo \"ORACLE AUTO|g" $ORACLE_BASE/$RUN_FILE
RUN sed -i "s|createDB;|createDB;$ORACLE_BASE/$PWD_FILE $NEW_ORACLE_PWD;su -p oracle -c sqlplus system/$NEW_ORACLE_PWD@//localhost:1521/$ORACLE_SID @$ORACLE_BASE/setup-script.sql|g" $ORACLE_BASE/$RUN_FILE
  • git clone git@github.com:oracle/docker-images.git
  • download oracle-xe-11.2.0-1.0.x86_64.rpm.zip from [http://www.oracle.com/technetwork/database/database-technologies/express-edition/downloads/index.html]
  • mv ~/Downloads/oracle-xe-11.2.0-1.0.x86_64.rpm.zip docker-images/OracleDatabase/dockerfiles/11.2.0.2
  • cd docker-images/OracleDatabase/dockerfiles
  • ./buildDockerImage.sh -v 11.2.0.2 -x
  • create setup-script.sql with commands
  • create Dockerfile for extensions to base image
  • docker build -f Dockerfile -t oracle/db:latest .
  • mkdir -p ~/data/oradata

To run:

docker run -p 1522:1521 -p 5500:5500 --shm-size=1g -v ~/data/oradata:/u01/app/oracle/oradata oracle/db:latest

CREATE USER build IDENTIFIED BY build;
GRANT CONNECT TO build;
GRANT EXECUTE on schema.procedure TO build;
quit;
/
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment