OracleXE 21c Docker Desktop Extension

Marcelo Ochoa
ITNEXT
Published in
4 min readJun 1, 2022

--

A new Docker Desktop Extension for using OracleXE 21c is ready for use!!!

Following my explanation about the importance of the ecosystem available for developers through Docker Extensions, I decided to build a new one for Oracle XE.

The idea behind this extension unlike PGAdmn4 Extension is to have a local Oracle XE 21c development Database ready to use just with one click. This extension looks like:

OracleXE Docker Extension EM Express login screen

Why do I need a OracleXE Docker Desktop Extension

Because many development stacks use Oracle as backend databases, these stacks could be PHP/Laravel, Java Spring Boot, NodeJs and many others, so usually developers need a DB to connect their development environments for testing.

Oracle DB is not an easy RDBMS to install, even using Docker technology, also Oracle XE is ready to download and install using Gerald Venzl Oracle XE 21.3.0-full optimized image.

In addition to above paragraph Oracle XE includes EM Express to easily monitor and diagnose your DB, EM Express integrated into Docker Desktop look like:

OracleXE EM Express welcome page

With EM Express you have a tool during development to analyze the impact of your query and anticipate these problems before going into production :)

Manual Installation

Until this extension is ready at Docker Extension Hub you can install just by executing:

$ docker extension install mochoa/oraclexe-docker-extension:21.3.0
Extensions can install binaries, invoke commands and access files on your machine.
Are you sure you want to continue? [y/N] y
Installing new extension "mochoa/oraclexe-docker-extension:21.3.0"
Installing service in Desktop VM...
Setting additional compose attributes
VM service started
Installing Desktop extension UI for tab "OracleXE"...
Extension UI tab "OracleXE" added.
Extension "OracleXE" installed successfully

Note: OracleXE Docker image is big (7GB) so first docker extension install will take a long time depending on your Internet connection, if you want a fast installation pull it first

$ docker pull gvenzl/oracle-xe:21.3.0-full

Note: Docker Extension CLI is required to execute above command, follow the instructions at Extension SDK (Beta) -> Prerequisites page for instructions on how to add it.

Using OracleXE Docker Extension

Once the extension is installed a new extension is listed at the pane Extension (Beta) of Docker Desktop.

By clicking at OracleXE icon the extension main window will show this extension in action

first startup will take several seconds depending on your hardware, this is because OracelXE is starting and creating the database, a progress indicator bar will wait until the RDBMS is ready:

Progress Bar Indicator

shows that OracleXE DB is not ready yet, when the RDBMS is ready the EM login screen will automatically loaded.

OracleXE EM Express Login Screen

A login screen will ask you for a sys password (default is Oracle_2022)

To connect from outside Docker containers, I mean applications not running as containers you can use localhost:1521 as is described in Quick Start page, in case you want to connect from another container running at Docker Desktop you have to use the internal IP for OracleXE, this is available at the menu, Settings -> Resources -> Network -> Docker subnet, in my case is 192.168.65.0/24 so an internal IP for reaching out OracleXE from containers running in Docker Desktop will be 192.168.65.2, also there is an internal DNS name that resolve above IP named host.docker.internal.

Docker Desktop Network IP range

Java sample in Quick Start page:

OracleDataSource ods = new OracleDataSource();
ods.setURL("jdbc:oracle:thin:@//localhost:1521/XEPDB1"); // jdbc:oracle:thin@//[hostname]:[port]/[DB service name]
ods.setUser("scott");
ods.setPassword("tiger");
Connection conn = ods.getConnection();
PreparedStatement stmt = conn.prepareStatement("SELECT 'Hello World!' FROM dual");
ResultSet rslt = stmt.executeQuery();
while (rslt.next()) {
System.out.println(rslt.getString(1));
}

means for a Java apps running as Docker container:

OracleDataSource ods = new OracleDataSource();
ods.setURL("jdbc:oracle:thin:@//host.docker.internal:1521/XEPDB1"); // jdbc:oracle:thin@//[hostname]:[port]/[DB service name]
ods.setUser("scott");
ods.setPassword("tiger");
Connection conn = ods.getConnection();
PreparedStatement stmt = conn.prepareStatement("SELECT 'Hello World!' FROM dual");
ResultSet rslt = stmt.executeQuery();
while (rslt.next()) {
System.out.println(rslt.getString(1));
}

As you can see, I am using historic user scott with password tiger, this user was created during the first startup of OracleXE.

Architecture

Under the hood this Docker Extension starts two containers, OracleXE database obviously and Caddy reverse proxy:

Docker Container Running

Caddy is a lightweight reverse proxy used to talk in plain http to Oracle EM Express which uses https with a self signed certificate which is not supported by Docker Desktop, OracleXE can be configured to listen in plain http but is more complicated that deploying Caddy.

Sources

As usual the code of this extension is at GitHub, feel free to suggest changes and make contributions, note that I am a beginner developer of React and TypeScript so contributions to make this UI better are welcome.

--

--