Is it possible to run an Oracle database in a container? And if so, is it supported for use in production?

The answer is “yes.” Surprised? Read on to learn how to rapidly deploy an Oracle 19c database on Kubernetes with Portworx® persistent storage.

Oracle Images

Oracle maintains 12.1, 12.2, and 19.3 database container images in the Oracle Container Registry (OCR). For this post, I’ll use the official Oracle 19.3 image. It’s also possible to build your own images for different versions using the Docker build scripts Oracle provides on GitHub.

Note: You’ll need an Oracle account to log in to the OCR and you’ll have to accept the Oracle licensing agreement before using the images.


GitHub Repository

Access the files I’ve referenced in this post from a public GitHub repository using git clone:

Kubernetes Namespace

Start by creating a dedicated namespace for our containerized Oracle 19c database using the kubectl create namespace <namespace> command:

To avoid having to specify the namespace each time with -n, you can use the set-context to default the namespace:

Kubernetes Secret

Next, we need to create a Kubernetes Secret. You can do this by logging in to the Oracle Container Registry using docker login and providing your Oracle credentials.

This will create a file ~/.docker/config.json. We can then use this file to create a secret.

Confirm the secret was created with kubectl get secret.

Kubernetes ConfigMap

For my Kubernetes build, I’ll use a ConfigMap to pass variables to the Oracle 19.3 container. This is an easy way to localize the database name and passwords.

Kubernetes Statefulset

We can now create an Oracle 19.3.0 database Kubernetes statefulset with kubectl apply.

The stateful set will create a Kubernetes pod for the database, a service for the database listener, a Portworx storage class, and three persistent volume claims (PVCs) for the Oracle database and startup and setup mount points.

Persistent Volume Claims

Before we attempt to connect to the database, let’s use kubectl get persistentvolumeclaims or pvc to list the volumes we’ll be using.

Portworx Volumes

We can also see the three Portworx-managed volumes by using pxctl volume list.

Connecting Remotely

To connect to our Oracle database remotely, we need to identify the service port that is mapped to the database listener. We can use kubectl get service or svc for this.

By using the command above, we can see that our Oracle listener (1521) is available externally on Port 30937 and Enterprise Manager (5500) is available on 32185.

Using the details provided in the ConfigMap and external service port, we can connect to our database remotely.


In this blog post, I’ve shared how you can deploy an Oracle 19c database on a Kubernetes cluster with Portworx persistent storage. I’ve also shown how to connect to the database remotely.

You can learn more about running Oracle on Kubernetes on my blog.

Finally, before you deploy any Oracle software on Kubernetes I suggest you consult the Running and Licensing Oracle Programs in Containers and Kubernetes guide to fully understand any licensing implications.