Running Oracle 19c in a Docker container: part 2: server up and running

Following on from my first attempt to get Oracle 19c running in a Docker container and running out of disk space in my VM, I increased the disk space to 40GB and restarted the steps to build the image. It took about 1.5hrs to complete building and doing the install into the image. Although building an image is a one time activity, unless you’re making changes to the image that’s still a long time, and not something you can do on a regular basis or on demand.

Next, starting up an container from the image, using the provided docker command from the docs:

docker run --name <container name> \
-p <host port>:1521 -p <host port>:5500 \
-e ORACLE_SID=<your SID> \
-e ORACLE_PDB=<your PDB name> \
-e ORACLE_PWD=<your database passwords> \
-e ORACLE_CHARACTERSET=<your character set> \
-v [<host mount point>:]/opt/oracle/oradata \

It then takes around 30mins before the server is actually up and running. At least it gives you some percentage status outputs as it’s starting up, but again, not really practical for starting a server up ondemand or on a whim. For reference, this is on my HP DL380 G7 server with dual 2.4GHz Xeons, running in an Ubuntu 18.04 VM with 4 vCpus and 8GB RAM.

Up and running:

LSNRCTL for Linux: Version - Production on 24-MAY-2019 04:55:03
Copyright (c) 1991, 2019, Oracle. All rights reserved.
Starting /opt/oracle/product/19c/dbhome_1/bin/tnslsnr: please wait…
TNSLSNR for Linux: Version - Production
System parameter file is /opt/oracle/product/19c/dbhome_1/network/admin/listener.ora
Log messages written to /opt/oracle/diag/tnslsnr/8363ae964727/listener/alert/log.xml
Version TNSLSNR for Linux: Version - Production
Start Date 24-MAY-2019 04:55:04
Uptime 0 days 0 hr. 0 min. 1 sec
Trace Level off
Security ON: Local OS Authentication
Listener Parameter File /opt/oracle/product/19c/dbhome_1/network/admin/listener.ora
Listener Log File /opt/oracle/diag/tnslsnr/8363ae964727/listener/alert/log.xml
Listening Endpoints Summary…
The listener supports no services
The command completed successfully

Prepare for db operation
8% complete
Copying database files
31% complete
Creating and starting Oracle instance
32% complete
36% complete
40% complete
43% complete
46% complete
Completing Database Creation
51% complete
54% complete
Creating Pluggable Databases
58% complete
77% complete
Executing Post Configuration Actions
100% complete
Database creation complete. For details check the logfiles at:
Database Information:
Global Database Name:ORADB1
System Identifier(SID):ORADB1
Look at the log file "/opt/oracle/cfgtoollogs/dbca/ORADB1/ORADB1.log" for further details.
SQL*Plus: Release - Production on Fri May 24 05:17:49 2019
Copyright (c) 1982, 2019, Oracle. All rights reserved.
Connected to:
Oracle Database 19c Standard Edition 2 Release - Production

Created a connection in SQLDeveloper and can connect!

Running Oracle 19c in a Docker container: part 1: out of disk space on my VM

This should be filed under “Can you? Yes. Should you? Probably not”

I tried creating a Docker container running Oracle 19c from Oracle official dockerfiles, and straight out of the gate ran out of diskspace:

!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! ERROR - There is not enough space available in the docker container. The container needs at least 18 GB, but only 14 GB are available.
Removing intermediate container b53a5e13a45c
The command '/bin/sh -c chmod ug+x $INSTALL_DIR/*.sh &&     sync &&     $INSTALL_DIR/$CHECK_SPACE_FILE &&     $INSTALL_DIR/$SETUP_LINUX_FILE &&     rm -rf $INSTALL_DIR' returned a non-zero code: 1

ERROR: Oracle Database Docker Image was NOT successfully created.
ERROR: Check the output and correct any reported problems with the docker build operation.

$ df -h
Filesystem      Size  Used Avail Use% Mounted on
udev            3.9G     0  3.9G   0% /dev
tmpfs           798M  1.3M  797M   1% /run
/dev/sda2        30G   12G   17G  41% /

The container needs at least 18GB? Of course it does.

Time to expand my VM disk space (using notes from when I previously had to do this here), and try again.

Kubernetes: creating a hostPath PersistentVolume in a single node cluster

To create a ‘hostPath’ PersistentVolume in a single node cluster (do not use in a cluster with more than 1 node):

kind: PersistentVolume
apiVersion: v1
name: pv1
type: local
storageClassName: manual
storage: 1Gi
- ReadWriteOnce
path: "/your-path-for-vol1"

If the above is pv1.yaml, apply with:

kubectl apply -f pv1.yaml

For more info, see the docs here.

Helm install of MariaDB on bare metal Kubernetes: “mkdir: cannot create directory ‘/bitnami/mariadb/data’: Permission denied”

Installing the MariaDB chart with Helm on Kubernetes, I ran into issues with permissions on the folder that I created for the PersistentVolume:

INFO  ==> ** Starting MariaDB setup **
INFO ==> Validating settings in MYSQL_/MARIADB_ env vars..
INFO ==> Initializing mariadb database…
mkdir: cannot create directory '/bitnami/mariadb/data': Permission denied
INFO ==> Stopping mariadb…

Per similar question here, if you’re manually creating or reusing a PersistentVolume for MariaDB, you need to “chown -R 1001:1001 /pv-dir” on the PV directory, as the MariaDB container runs with userid 1001 and group 1001.