Building a Oracle 12.2 Docker Image

…or a 12.2…or a 11.2 image…

Docker installation instructions for RHEL 7.

To quickly build an Oracle database Docker image, you can clone the official Oracle Git repository and run the included build script. This isn’t too difficult and worked really nicely on my MacBook Pro.

However, when I tried setting it up on an Oracle cloud compute instance, I came across an error that forced me to learn a few more things about Docker in order to get it to work.

The basic steps are outlined in the README.md file. However, when following the steps, the build script failed due to a memory error.

Setup

First I wanted to make sure that all docker images and containers will run on a mount point that had plenty of room. In my case, this was /u01. So I needed to change the Docker configuration to use that directory rather than the default of /var/lib/docker. To do that follow these instructions and change the /lib/systemd/system/docker.service file. I commented out the original text and added the new version of ExecReload:

The second thing I had to do is change the Docker base image size. To see what that is use:

To build the Oracle database image you need a minimum of 15GB. To do this edit or create the file /etc/sysconfig/docker-storage and add

DOCKER_STORAGE_OPTIONS= –storage-driver devicemapper –storage-opt dm.basesize=25G

Now bounce the Docker daemon and check the base image size:

I also had to make sure that my system is clean, i.e. no other Docker images or containers.

Now I was able to run the build script as per instructions and build the database image.

Running the Image

Once the image is built, you need to run it mapping the ordadata directory to a directory on the host. I used /u01/oracle/oradata/docker-12.2.0.1ee, which is owned by the OS user cruepprich and group cruepprich. The oracle user inside the container needs to have permissions to that directory. The UID of the oracle user inside the container is 54321. So add that UID to the host and assign it to the group owning the directory:

In order to pull the Oracle image, you need to log into your docker account:

Now run the container from a shell script that looks something like this:

You can follow the startup log with:

To log into SQL*Plus as sysdba use:

For further commands, and documentation see:

https://github.com/oracle/docker-images/blob/master/OracleDatabase/SingleInstance/README.md

 

Test:

 

 

Leave a Reply

Your email address will not be published. Required fields are marked *