This post describes my journey to building and using a docker image for Oracle.
It all started as usual searching the web for hints and many results led to the Oracle docker Github repository.
This repository under
OracleDatabase provides (almost) all the informations needed.
My target machine: MacBook Pro (13-inch, Mid 2009), OS X Yosemite 10.10.5.
I decided to use
Oracle XE 18.104.22.168 because my use case just needed an Oracle DB,
so no need to go for bigger and fancier versions.
So without further ado here is what I tried and what did not work and which solutions I found:
👍clone the relevant github repo:
$ git clone https://github.com/oracle/docker-images oracle-docker-images $ cd oracle-docker-images/OracleDatabase/dockerfiles
😞download the relevant file from Oracle, in my case,
oracle-xe-11.2.0-1.0.x86_64.rpm.zip. Put it in the
22.214.171.124directory (DO NOT UNZIP). (Of course Oracle makes this step a pain in the neck, i.e. no simple
curlor any other possibility to just download it…yes with the implicit acknowledgement that you agree with their terms…)
👍run you docker daemon. I am on an old MBP, so no native docker… Remember to note down the docker machine IP,
dockerstartup spits something like:
docker is configured to use the default machine with IP 192.168.99.100
I discovered this later on once I had built a docker image…for non native docker you need to increase the swap memory of your VM:
$ docker-machine stop default $ VBoxManage modifyvm default --memory 8192 $ docker-machine start default
👎as per README, execute the build script (make sure your docker daemon is running):
$ ./buildDockerImage.sh -v 126.96.36.199 -x Checking if required packages are present and valid... usage: md5sum [file...] MD5 for required packages to build this image did not match! Make sure to download missing files in folder 188.8.131.52.
👍So…maybe that is why the
-iflag has been added…
$ ./buildDockerImage.sh -v 184.108.40.206 -x -i Ignored MD5 checksum. ===================== Building image 'oracle/database:220.127.116.11-xe' ... Sending build context to Docker daemon 315.9 MB Step 1 : FROM oraclelinux:latest ... Step 2 : MAINTAINER Gerald Venzl <email@example.com> ... Step 3 : ... ... Step 4 : ENV PATH $ORACLE_HOME/bin:$PATH ... Step 5 : COPY $INSTALL_FILE_1 $CONFIG_RSP $RUN_FILE $PWD_FILE $INSTALL_DIR/ ... Step 6 : RUN yum -y install ... ... Step 7 : VOLUME $ORACLE_BASE/oradata ... Step 8 : EXPOSE 1521 8080 ... Step 9 : CMD $ORACLE_BASE/$RUN_FILE ... Oracle Database Docker Image for 'xe' version 18.104.22.168 is ready to be extended: --> oracle/database:22.214.171.124-xe Build completed in 301 seconds.
Create a place where the DB will be persisted between runs:
$ mkdir -p ~/var/lib/docker/oracle/$USER
Run it (and note down the automatically generated password):
$ docker run --shm-size=1g \ -p 1521:1521 -p 8080:8080 \ -v $HOME/var/lib/docker/db/$USER:/u01/app/oracle/oradata \ oracle/database:126.96.36.199-xe
Change the default password:
$ docker ps CONTAINER ID IMAGE ... 22088d2ed7a3 oracle/database:188.8.131.52-xe ... $ docker exec 22088d2ed7a3 /u01/app/oracle/setPassword.sh cucu
and connect to it (the IP
192.168.99.100is the one from above;
sqlis new Oracle’s command line interface, see sqlcl):
$ ~/tools/sqlcl/bin/sql system/cucu@//192.168.99.100:1521/XE