(English) How to setup Docker container Oracle Database 12c for Liferay Development Environment

Ci spiace, ma questo articolo è disponibile soltanto in Inglese Americano. Per ragioni di convenienza del visitatore, il contenuto è mostrato sotto nella lingua alternativa. Puoi cliccare sul link per cambiare la lingua attiva.

When we start a new project using Liferay and the project involves the development of new entities, I suggest to set up your own local development environment as closely as possible to the customer’s development environment, particularly as regards the database.

In this article I will explain how to use Docker to setup the Oracle 12c container for use with Liferay. I also recommend reading the article How to build a Docker Liferay 7.2 image with the Oracle Database support.

1. What are the requirements

Before proceeding with the Docker container setup, let’s see what the requirements are.

  1. You need an account on Docker, which you can create from Docker – Signup;
  2. You need to install or update Docker on your PC. Refer to this article for how to install Docker on Windows.

The docker versions on which I have successfully run the Oracle Docker container are: 17.x, 18.x and 19.x. The version of Docker Engine (Community Edition) that I will refer to in this article is 19.03.1 (you can check version with command docker version).

What is shown in this article can be performed on Windows, Unix-like operating systems. In my case I use macOS. However, always refer to the documentation of Docker and Oracle for what concerns the minimal requirements that the target system must have.

2. Oracle Database 12c Docker Image

For some years now, Oracle Database Enterprise Edition 12c is available as an image in Docker Store. From the Docker Store you need to checkout and accept the terms. After accepting the terms you should find yourself on the page that explains the instructions for use.

The following figures show the checkout, acceptance of the terms and get Oracle Database Enterprise Edition. The latest version available is 12c Release 2, this release is the version supported by Liferay (you can see Liferay Digital Experience Platform 7.2 Compatibility Matrix).


Figure 1 - Checkout Oracle Database Enterprise Edition

Figure 1 – Checkout Oracle Database Enterprise Edition


Figure 2 - Get Oracle Database Enterprise Edition Developer Tier

Figure 2 – Get Oracle Database Enterprise Edition Developer Tier


Figure 3 - Setup instruction

Figure 3 – Setup instructions

3. How to starting an Oracle Database Server instance

The next steps to start the Oracle Database container are as follows:

  1. Docker login
  2. Pull Oracle Database Enterprise Edition
  3. Run Docker container from image

Following the sequence of commands needed to start the container.

The pull of the Oracle image may take several minutes due to the size of about 4GByte. Following the output of the pull operation.

Figure 4 - Output of the Docker Pull command

Figure 4 – Output of the Docker Pull command

This Oracle database server image uses Docker data volumes to store data files, redo logs, audit logs, alert logs and trace files. The data volume is mounted inside the container at /ORCL. To use a directory on the host system for the data volume, I created the oracle-db-data directory.

The docker run command starts the database with the following features:

  1. Assign the container the name oracle-db-12c
  2. Exposes the TCP/IP SQL Net port 1521
  3. Through the environment variables
    1. Set the SID to ORALFR
    2. Set the PDB to ORALFRPDB
    3. Set the DB Domain to oracledb.liferay.local
  4. Configure volume usage

Obviously you can customize the values of the start parameters to your liking, these are the ones I usually use for my development environment.

You can monitor the start of the container by viewing the logs or using the docker command below.

The figure below shows the output of the docker ps command. You can see the status of the container indicating that it is ready (healthy) for use and port 1521 is exported.

Figure 5 - Output of the Docker ps command for checking status of the oracle-db-12c container

Figure 5 – Output of the Docker ps command for checking status of the oracle-db-12c container

4. Oracle Database Setup for Liferay

We are almost there! Now that our Oracle Database container is up, we need:

  1. Check the block size which should be 8KByte, as requested by Liferay;
  2. Check the character set which should be AL32UTF8, as requested by Liferay;
  3. Creating tablespaces for Liferay data;
  4. User creation and grant assignment

All database operations will be performed via SQLPlus after connecting to the container. The default password to connect to the database with sys user is Oradoc_db1.

The following command executes the SQLPlus on the container.

The figure below shows the size of the block size.

Figure 6 - Check Oracle Block Size

Figure 6 – Check Oracle Block Size

The figure below shows the character set which in this case is correctly configured with AL32UTF8.

Figure 7 – Check character set MUST be AL32UTF8

At this point we proceed with the creation of the tablespaces, one for the data and one for the temporary data. Usually in the development environment, for each Liferay project I prefer to create ad hoc tablespaces and avoid using the default USERS and TEMP tablespaces in order to make database management easier, especially when we have multiple Liferay projects.

Exact recommended size for tablespaces cannot be given because every deployment is different and might be used in various scenarios. Here are a few best practices:

  • Do not start with too large initial size, becuase it can waste space.
  • Do not allow individual data files grow large (beyond 8-10Gb) – it is impractical from a maintenance point of view. Rather add multiple data files (with 8-10Gb maximal size each) instead.
  • Use a single block-size (8K) for the whole DB to avoid buffer pool management pitfalls for non-standard tablespaces (whose block size is different from DB_BLOCK_SIZE).

As a last step we have to create user and assign him the correct grants.

At this point we are in a position to perform a connection test to the new scheme using a tool such as Oracle SQLDeveloper. The following figures show the configuration of the database connection, the view of the Liferay tables and the status of the tablespaces created for Liferay.

The parameters to connect to the new Liferay scheme are:

  • Username/password: liferay_myproject/liferay_myproject
  • Hostname: localhost
  • Service Name: ORALFRPDB.oracledb.liferay.local


Figure 8 - Configuring connection to the Oracle database via SQL Developer

Figure 8 – Configuring connection to the Oracle database via SQL Developer


Figure 9 - View Liferay Tables

Figure 9 – View Liferay Tables


Figure 10 - Overview on the status of the Oracle Database

Figure 10 – Overview on the status of the Oracle Database

Now we can connect our Liferay instance to the Oracle database we have just configured 😉

The figure below also shows the status of the Docker Liferay container that uses the Oracle Database instance that we configured during this article.

Figure 11 - Status of the docker container Liferay and Oracle

Figure 11 – Status of the docker container Liferay and Oracle


In this article I wanted to show you how I usually configure my development environment when I need to have an Oracle Database to be later connected to Liferay.

As you have seen, using Docker makes this all very simple and fast.

Do not hesitate to contact me with any questions and I hope this article has been helpful.

2 Condivisioni

Antonio Musarra

I began my journey into the world of computing from an Olivetti M24 PC (http://it.wikipedia.org/wiki/Olivetti_M24) bought by my father for his work. Day after day, quickly taking control until … Now doing business consulting for projects in the enterprise application development using web-oriented technologies such as J2EE, Web Services, ESB, TIBCO, PHP.

Potrebbero interessarti anche...

Liferay 7.2 GA2 & Wildfly 16Come installare Liferay 7.2 GA2 su Wildfly 16 + il supporto Oracle Database 19c

Nel corso di questo video tutorial, vedremo come installare Liferay Portal 7.2 GA2 Community Edition su WildFly 16 con il supporto verso Oracle Database 19c.

Il supporto per WildFly 16 è stato aggiunto da Liferay 7.1 (vedi Matrice di Compatibilità). Il supporto per Oracle Database 19c è disponibile dalla versione 7.0 di Liferay. Il repository GitHub liferay-portal-72-wildfly-16 (https://github.com/amusarra/liferay-portal-72-wildfly-16) contiene il layout d'installazione e i file di configurazione di Liferay e WildFly.

Nel caso in cui non abbiate un'istanza Oracle Database 19c disponibile, potreste creare la vostra da zero, per questo v'invito a leggere l'articolo How to setup Docker container Oracle Database 19c for Liferay Development Environment. Sul mio account SlideShare sono disponibili le slide in formato PDF https://bit.ly/3bVoSST Non esitate a lasciare i vostri feedback su questo video tutorial.

Cos'è il progetto CIE/CNS Apache Docker - Developers Italia

In questo video https://youtu.be/TcAzn1POhsM introdurrò il progetto CIE/CNS Apache Docker di Developers Italia (https://developers.italia.it/it/cie/#resourcecontent-3) nato circa due anni fa.

L'obiettivo di questo progetto è quello di fornire un template pronto all'uso che realizza un sistema di autenticazione tramite la Smart Card TS-CNS (o CNS) e la CIE (Carta d'Identità Elettronica) basato su Apache HTTP. Ognuno può poi modificare o specializzare questo progetto sulla base delle proprie esigenze Si tratta di un progetto docker per la creazione di un container che implementa un sistema di mutua autenticazione o autenticazione bilaterale SSL/TLS.

Questo meccanismo di autenticazione richiede anche il certificato digitale da parte del client, certificato che in questo caso risiede all'interno della TS-CNS o della CIE. La particolarità del sistema implementato (attraverso questo container) è quella di consentire l'autenticazione tramite:

  • La TS-CNS (Tessera Sanitaria - Carta Nazionale Servizi), rilasciata dalla regione di appartenenza;
  • La CIE (Carta d'Identità Elettronica), rilasciata dal comune di residenza.

Nella versione 2.0.0 il progetto è stato aggiornato per essere uniforme alle linee guida di Bootstrap Italia. A seguire alcune risorse che possono essere utili.

  • Cos’è il progetto CIE/CNS Apache Docker (http://bit.ly/3aJ5Gbl)
  • CIE Carta d'Identità Elettronica (https://developers.italia.it/it/cie/)
  • Carta Nazionale dei Servizi (https://www.agid.gov.it/it/piattaforme/carta-nazionale-servizi)
  • Raspberry Pi – Un esempio di applicazione della TS-CNS (https://bit.ly/3hkJ8Aj)
  • Pubblicare il servizio CIE/CNS Apache Docker su Azure Cloud (http://bit.ly/3aPoq8V)
  • Come accedere al portale VETINFO tramite TS-CNS e Mac OS (http://bit.ly/2VFMKq7)