Adding Examples to a Docker Container with Oracle database 12.2

March 5, 2017

database

Oracle Database 12.2 became available for download last week. This weekend I’ve been playing with Docker and created a container with it. The whole process is so easy, thanks to the work by Gerald Venzl at Oracle. You’ll find all the information you need in his blog post . Though the post is for version 12.1.0.2, the dockerfiles have already been updated for 12.2.0.1, and you can download it from Github using the link he provides in the post.

It takes sometime to create a container (depending on your hardware, of course), so when I discovered that the examples / demos that are distributed in another file  were not included, I decided to try to add it to the running container.  It is easy, just download the linuxx6412201examples.zip file and copy it into the running container, which in my case is named ora12.2:

docker cp linuxx6412201examples.zip ora12.2:/tmp  

Also unzip a copy of the included response file locally:

unzip -j -d /tmp linuxx6412201examples.zip \ 
examples/response/demosinstall.rsp   

Edit it and change the variables so they look like this:

UNIXGROUPNAME=oinstall  
ORACLEHOME=/opt/oracle/product/12.2.0.1/dbhome1  
ORACLEBASE=/opt/oracle  

Copy it to the container:

docker cp /tmp/demosinstall.rsp ora12.2:/tmp  

Connect to your container with a command similar to this (again, ora12.2 is the name of my container):

docker exec -ti ora12.2 /bin/bash  

Inside the container, unzip the transferred zip file and start the installation with:

cd /tmp  
unzip linuxx6412201examples.zip  
cd examples  
./runInstaller -silent -force -waitforcompletion \ 
responsefile /tmp/demosinstall.rsp  -ignoresysprereqs -ignoreprereq  

You can now verify that you have more demos installed, for instance under $ORACLEHOME/md/demo.

Of course you can achieve the same effect by adding a few lines to the Dockerfile, build, and run again. Something like this should do for the Dockerfile:

 Added install of examples   
ENV EXAMPLERSP="demosinstall.rsp" \ 
    EXAMPLEFILE="linuxx6412201examples.zip"  
COPY $EXAMPLERSP $EXAMPLEFILE /tmp/  
RUN cd /tmp && \ 
  unzip linuxx6412201examples.zip && \ 
  cd examples && \ 
  ./runInstaller -silent -force -waitforcompletion \ 
  -responsefile /tmp/demosinstall.rsp  -ignoresysprereqs -ignoreprereq  

It turned out to run just as fast since the new build builds on the previous images, oh well.