By following this tutorial, you will be able to connect to a local/remote Oracle DB using an Oracle client running on Docker.

(01) On browser, login to your Docker Hub account and checkout to get the official Oracle Instant Client image.

(02) On terminal, login to the same Docker Hub account again and pull Oracle Instant Client image.

$ docker login
$ docker pull store/oracle/database-instantclient:12.2.0.1

(03) Run the Oracle Instant Client image as a container.

$ docker run --rm -it --name Oracle_Instant_Client_Container store/oracle/database-instantclient:12.2.0.1

(04) Connect your Oracle Database instance using SQL Plus.

$ docker exec -it Oracle_Instant_Client_Container /bin/bash

$ sqlplus <USERNAME>/<PASSWORD>@//<IP_ADDRESS>:1521/<DB_NAME>
$ sqlplus <USERNAME>/<PASSWORD>@//<IP_ADDRESS>:1521/<SID>.<DOMAIN_NAME>

// first-time useers as SYSDBA role of SYS user
bash-4.2# sqlplus sys/Oradoc_db1@172.17.0.2:1521/ORCLCDB.localdomain as sysdba

// existing users
bash-4.2# sqlplus app_user/pf123@172.17.0.2:1521/ORCLCDB.localdomain

✅ Tested DB : Oracle 12c
✅ Tested OS's : RHEL 7+, CentOS 7+, Ubuntu 18.04+, Debian 8+
✅ Tested Gear : Cloud (AWS EC2 T2), On-Prem (Bare Metal)

Leave a comment