Oracle Database 12c now available on Docker

Last week at Dockercon, Oracle announced that the Oracle Database is now available alongside other Oracle products the on Docker Store.

Given how much folks here in Silicon Valley (including my better half) rave about how easy and great Docker is, I thought I would try it out and share with you exactly how I did.

Since I was a Docker virgin, the first thing I had to do was download and install Docker. A quick trip to the Docker Store followed by a double click and I was up and running!

Next I needed to get the new Oracle Database container. You have two options here:

  1. Go back to the Docker Store and search for “oracle database ”, which will return a Docker container that has a database but is not a persistent image. That means if you drop the container the database disappears too. It’s also not possible to unplug the database from within the container and plug it in anywhere else.
  2. Go to Github and get an Oracle Docker build files and then go to and get the 12.2 database software. This combination will allow you to create a Docker container that has the latest 12.2 database and is persisted. That is to say if the container is dropped you still have the database and it is possible to unplug the database and plug it in somewhere else.

I chose to go with option 2, which is a wee bit more involved but having 12.2 and a persistent image were both, very important to me. And before you ask, yes 12.2 will be made available in the Docker Store and it will be persistent. It’s just not there yet.

The steps below explain exactly what I did (with some help from @GeraldVenzl)

1. Go to and download the Oracle Docker build files.

2. Go to and download Oracle Database 12c Release 2 for Linux x86-64.

3. You should now have two files:

Unzip the file, which will result in a new directory called docker-images-master. This directory contains 12 subdirectories, one of each of the Oracle products supported on Docker.

creating: docker-images-master/
extracting: docker-images-master/.gitattributes
inflating: docker-images-master/.gitignore
inflating: docker-images-master/.gitmodules
inflating: docker-images-master/

4. Copy the 12.2 software ( into the /docker-images-master/OracleDatabase/dockerfiles/ subdirectory.

5. Next you need to create the Docker image. I took the easy route and utilized the shell script, which is included in It will create an image using oraclelinux:7-slim and which ever database version you specify. I used the following command to install Oracle Database 12.2 software:

./ -v -e
Checking if required packages are present and valid... OK
Building image 'oracle/database:' ...
Sending build context to Docker daemon 2.688 GB

the installer reaches out the internet to get oraclelinux:7-slim and to do a yum update of the OS inside the container, so if you are doing this behind a corporate firewall you will need to explicitly set the environment variable https_proxy. The script will automatically detect http_proxy and https_proxy and pass it on to Docker to use for the image build.

6. Once the image is built you can check what you have by running the “docker images” command

docker images
REPOSITORY         TAG               IMAGE ID           CREATED             SIZE
oracle/database      7c2999a16928       7 hours ago       14.8 GB
oraclelinux         7-slim           442ebf722584       5 days ago         114 MB

As you can see I have installed, Oracle Linux and the Oracle Database software. We don’t have a database yet.

7. In order to get an actual database, we need to create our first container. I used the “docker run” command below to do this and supplied a couple of additional parameters for mappings since I wanted to persist the database files even if the container was removed.

docker run --name oracle -p 1521:1521 -p 5500:5500 
-v /Users/mcolgan-mac/oradata:/opt/oracle/oradata oracle/database:
LSNRCTL for Linux: Version - 
Production on 26-APR-2017 18:04:36
Copyright (c) 1991, 2016, Oracle.  All rights reserved.
Starting /opt/oracle/product/ 
please wait...
TNSLSNR for Linux: Version - Production
System parameter file is /opt/oracle/product/
Log messages written to /opt/oracle/diag/tnslsnr/75ca99d5275d/listener/alert/log.xml
Listening on: (DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=75ca99d5275d)(PORT=1521)))
Connecting to (ADDRESS=(PROTOCOL=tcp)(HOST=)(PORT=1521))

–name   Gave the new container the name “oracle” (will be auto genearted if omitted)
-p            Mapped port 1521 and 5500 on my laptop to the corresponding ports inside the container
-v             Mapped my local directory (/Users/mcolgan-mac/oradata ) to the default location where the data files will be stored (:/opt/oracle/oradata) to ensure the files are persisted outside my container.

8. The “docker run” command actually calls the Oracle DBCA and automatically creates a database. Since this is a 12c database it will automatically create a container database ORCLCDB and one pluggable database ORCLPDB1 (both can be overwritten if you wish).
I didn’t specify a password for the SYS, SYSTEM or PDBADMIN accounts in my command, so one was automatically generated for me and displayed in the output of the command. Be sure to change the password from this default. You can do this using the “docker exec” command once your database is up and running.

docker exec oracle ./ XXXXXX

9. We can confirm our container was created successfully and is running by using the “docker ps” command.

docker ps -a
CONTAINER ID       IMAGE                         COMMAND                 CREATED        STATUS        PORTS         NAMES
75ca99d5275d       oracle/database:   "/bin/sh -c 'exec ..."   8 hours ago   Up 5 hours    oracle

10. Going forward all we need to do is start and stop the container, which will open and close the database.

docker start oracle
docker stop oracle

You can monitor exactly what is going during these commands by looking at the docker logs using the docker log command.

docker logs oracle
LSNRCTL for Linux: Version - Production on 27-APR-2017 18:58:05
Copyright (c) 1991, 2016, Oracle.  All rights reserved.
Starting /opt/oracle/product/ please wait...
TNSLSNR for Linux: Version - Production
System parameter file is /opt/oracle/product/
Log messages written to /opt/oracle/diag/tnslsnr/75ca99d5275d/listener/alert/log.xml
Listening on: (DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=75ca99d5275d)(PORT=1521)))
Connecting to (ADDRESS=(PROTOCOL=tcp)(HOST=)(PORT=1521))
Alias                     LISTENER
Version                   TNSLSNR for Linux: Version - Production
Start Date                27-APR-2017 18:58:05
Uptime                    0 days 0 hr. 0 min. 2 sec
Trace Level               off
Security                  ON: Local OS Authentication
SNMP                      OFF
Listener Parameter File   /opt/oracle/product/
Listener Log File         /opt/oracle/diag/tnslsnr/75ca99d5275d/listener/alert/log.xml
Listening Endpoints Summary...
The listener supports no services
The command completed successfully
SQL*Plus: Release Production on Thu Apr 27 18:58:08 2017
Copyright (c) 1982, 2016, Oracle.  All rights reserved.
Connected to an idle instance.
SQL> ORACLE instance started.
Total System Global Area 1610612736 bytes
Fixed Size		    8793304 bytes
Variable Size		  520094504 bytes
Database Buffers	 1073741824 bytes
Redo Buffers		    7983104 bytes
Database mounted.
Database opened.
SQL> Disconnected from Oracle Database 12c Enterprise Edition Release - 64bit Production
ORCLPDB1(3):Database Characterset for ORCLPDB1 is AL32UTF8
ORCLPDB1(3):Opatch validation is skipped for PDB ORCLPDB1 (con_id=0)
ORCLPDB1(3):Opening pdb with no Resource Manager plan active
Pluggable database ORCLPDB1 opened read write
Starting background process CJQ0
CJQ0 started with pid=40, OS id=262 
Shared IO Pool defaulting to 64MB. Trying to get it from Buffer Cache for process 81.
Dumping current patch information
No patches have been applied
db_recovery_file_dest_size of 12780 MB is 0.00% used. This is a
user-specified limit on the amount of space that will be used by this
database for recovery-related files, and does not reflect the amount of
space available in the underlying filesystem or ASM diskgroup.

So there you have it, ten simple steps to get you up and running with Oracle Database 12.2 on Docker. If you want more details on building Oracle Database Docker images, check out Gerald’s blog.

This entry was posted in Docker, Oracle Database 12c New Features and tagged , . Bookmark the permalink.

2 Responses to Oracle Database 12c now available on Docker

  1. Naveen says:

    ./ –v –e

    Checking if required packages are present and valid… OK OK
    Building image ‘oracle/database:’ …
    Sending build context to Docker daemon 2.688 GB ~ ???

    • Maria Colgan says:

      Hi Naveen,

      You caught me!

      I forgot to capture the screen output for this step, so I stole some from Gerald’s blog without realizing he had installed and not LOL!

      I’ve gone ahead and corrected the mistake!

      Thanks for keeping me honest,

Leave a Reply

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