WildFly 16 Docker Image with Oracle JDBC Driver

Posted by Dirk Nachbar on Friday, May 03, 2019
Today some a bit off-topic blogpost from my usual classic Oracle blogpost, but with a bit of Oracle :-)

As more and more of my customers are moving away from Oracle WebLogic Server to JBoss/WildFly, I have create a small Docker Image with WildFly 16 including the Oracle JDBC Driver and a DataSource based on the Oracle JDBC Driver (18.3).

The full showcase you can find in my GitHub Repository https://github.com/DirkNachbar/Docker/tree/master/WildFly

Simply clone the repository to your machine hosting your Docker.

At first you will need to align the oracle-driver.cli script to reflect your required DataSource settings to connect to your Oracle Database

# Snippet from oracle-driver.cli
data-source add --name=<DataSourceName> --driver-name="oracle" --jndi-name="java:<JNDI Lookup Name>" --statistics-enabled="true" --user-name="<Oracle Username>" --password="<Oracle User Password>" --initial-pool-size="<Initial Pool Size>" --max-pool-size="<Max Pool Size>" --min-pool-size="<Minimal Pool Size>" --connection-url="jdbc:oracle:thin:@<Oracle Database Servername>:<Listener Port>/<Database ServiceName>" --check-valid-connection-sql="select 1 from dual"

# For example:
data-source add --name=testDS --driver-name="oracle" --jndi-name="java:/jdbc/testDS" --statistics-enabled="true" --user-name="soe" --password="soe" --initial-pool-size="25" --max-pool-size="50" --min-pool-size="20" --connection-url="jdbc:oracle:thin:@oraxe18c:1521/XEPDB1" --check-valid-connection-sql="select 1 from dual"
#

Now you can build the WildFly 16 Image:

In case you dont provide the --build-arg WILDFLY_ADMIN_PWD, the admin user of your WildFly will get the default password admin.

$ docker build [--build-arg WILDFLY_ADMIN_PWD=<your admin password>] -t wildfly .
# For Example:
$ docker build --build-arg WILDFLY_ADMIN_PWD=Oracle18c -t wildfly .

After the build is completed you can start your WildFly 16 Container with following command:

$ docker run -d --name wildfly \
      [--network=<Your bridged network>] \
      -p <Your Host Port>:8080 -p <Your Host Port>:9990 \
      -e TZ=<Your Timezone> \
      wildfly

Now you can access the HAL Management Console of your WildFly 16 with your forwarded port of the Docker Container Port 9990, login with admin and your provided password in the --build-arg WILDFLY_ADMIN_PWD or if you didnt used the --build-arg you the password "admin"



After the Login, click on the option "Configuration"



On the Configuration screen navigate to "Subsystems / Datasources & Drivers / JDBC Drivers / oracle" to check your deployed JDBC Driver



On the Configuration screen navigate to "Subsystems / Datasources & Drivers / Datasources / testDS" to check your created DataSource





Categories: , ,