image_pdfimage_print

Introduction

During DockerCon 2017 Oracle announced support for Oracle 12.1 Database docker images – see press release: Oracle Brings Oracle’s Flagship Databases and Developer Tools to the Docker Store. In this Post I will detail how you can use the excellent new Oracle docker image to rapidly deploy an Oracle 12c database within a container and then extend the container to use persistent storage provided by a Pure Storage FlashArray, by default the Oracle 12c docker image provides non-persistent storage (see Oracle limitation statement below).

Limit statement: from docker store

docker delete

This image does not support Docker volumes! The database inside the Docker image stores all data in non-persistent storage. When the container is deleted, all data in this container will be deleted as well. Delete the container with caution.

Our Oracle 12c database docker container will enjoy all the benefits of a Pure Storage FlashArray including low latency performance, space efficient crash consistent snapshots and will not require any local storage.

Getting Started

Before we try and ‘pull’ the new Oracle 12c docker image we will need to create a Docker account, login to the Docker Store, and complete the Oracle form, providing your name, company, phone number and then accept the Oracle license agreement. You can now download the Oracle 12c Database Docker images from the Docker Store using your credentials.

.docker store

The ‘Setup Instructions’ button provides details on how ‘pull’ the image and also how to set-up the your Oracle database within Docker.

The Docker image includes all the required Oracle files so is pretty large coming in at ~5.2GB, so it may take a while to download.

Use the docker image command to list installed images.

Creating docker volumes

Before I run my Oracle 12c docker container I will create 4 volume to support the following database layout:

/u01 – OraInventory and Oracle 12c product directories
/u02 – Oracle Datafile
/u03 – Fast Recovery Area
/u04 – RedoLog files.

I have already installed the Pure Storage docker volume plug-in and have documented this here, to create the 4 volumes we will use the docker volume create command providing name, size and label. e.g.

We can use the docker volume ls command with a filter to list the 4 database volumes we are interested in using the following syntax

The Pure Storage Docker Plugin also supports docker volume inspect, from here we can see the labels which we defined earlier, great way to see where and what the mount is being used for. e.g.

Now that we have installed the Oracle 12c docker image and created the our 4 database volumes we are ready to create our Oracle 12c container using the docker run command with -v to present our newly created volumes to our container.

Running the Container

Before we can use the Oracle Docker image we just downloaded we must first create an environment file as documented in the ‘Setup Instructions’ and customise the environment file updating the database name, password, domain and feature bundle as required.

We will use the docker run command to start our Oracle database docker

Parameters:

-d – run docker container in background (detached)
–env-file <path_to_env_file> environment file you created using above example.
-p <listener_port> is the port on host machine to map the container’s 1521 port (listener port).
-p <http_port> is the port on host machine to map the container’s 5500 port (http service port).
–name <container_name> container name you want to create
–shm-size <shared_memory_size> container memory size, minimum requirement is 4GB e.g. –shm-size=”4g”
-v <volume name : mount point>
<image_name> name of Oracle image download to be used to create container.

In this example our environment file is called PSTG_env.dat and our container is going to be called PSTG

We can monitor progress of the build using docker logs providing the docker name.

Once the container has started we can now connect to it and check out our Oracle 12c environment using the docker exec command and container name

From within our Oracle 12c ‘PSTG’ docker container we can see our Pure Storage volumes (/u01, /u02, /u03 & /u04) and the sizes we specified.

From sqlplus we can now see our persistent Oracle data files.