Docker image for locally testing Oracle


Enrico Spinielli


October 31, 2016

Docker for Oracle

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.

Which Oracle RDBMS?

I decided to use Oracle XE 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:

  • :thumbsup: clone the relevant github repo:

    $ git clone oracle-docker-images
    $ cd oracle-docker-images/OracleDatabase/dockerfiles
  • :disappointed: download the relevant file from Oracle, in my case, Put it in the directory (DO NOT UNZIP). (Of course Oracle makes this step a pain in the neck, i.e. no simple curl or any other possibility to just download it…yes with the implicit acknowledgement that you agree with their terms…)

  • :thumbsup: run you docker daemon. I am on an old MBP, so no native docker… Remember to note down the docker machine IP, docker startup spits something like: docker is configured to use the default machine with IP

  • 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
  • :thumbsdown: as per README, execute the build script (make sure your docker daemon is running):

    $ ./ -v -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
  • :thumbsup: So…maybe that is why the -i flag has been added…

    $ ./ -v -x -i
      Ignored MD5 checksum.
      Building image 'oracle/database:' ...
      Sending build context to Docker daemon 315.9 MB
      Step 1 : FROM oraclelinux:latest
      Step 2 : MAINTAINER Gerald Venzl <>
      Step 3 : ...
      Step 4 : ENV PATH $ORACLE_HOME/bin:$PATH
      Step 6 : RUN yum -y install ...
      Step 7 : VOLUME $ORACLE_BASE/oradata
      Step 8 : EXPOSE 1521 8080
      Oracle Database Docker Image for 'xe' version is ready to be extended:
      --> oracle/database:
      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 \
  • Change the default password:

    $ docker ps
    CONTAINER ID        IMAGE                         ...
    22088d2ed7a3        oracle/database:   ...
    $ docker exec 22088d2ed7a3 /u01/app/oracle/ cucu
  • and connect to it (the IP is the one from above; sql is new Oracle’s command line interface, see sqlcl):

    $ ~/tools/sqlcl/bin/sql system/cucu@//