-
Install docker for your OS
-
Download image
$ docker pull blakeberg/oracledb
- Run image
$ docker run -d -h orxe11g --name=orxe11g -p 49132:22 -p 49133:1521 blakeberg/oracledb:1.0
- Login to running instance (password: admin)
$ ssh root@localhost -p 49132
- Check the db is working well, in the instance
root@orxe11g:~# echo 'SELECT SYSDATE FROM DUAL;' | sqlplus system/oracle
SQL*Plus: Release 11.2.0.2.0 Production on Tue Jul 18 04:51:21 2017
Copyright (c) 1982, 2011, Oracle. All rights reserved.
Connected to:
Oracle Database 11g Express Edition Release 11.2.0.2.0 - 64bit Production
SQL>
SYSDATE
---------
18-JUL-17
SQL> Disconnected from Oracle Database 11g Express Edition Release 11.2.0.2.0 - 64bit Production
- For using the db from your OS, we need to run it with updated listner
root@orxe11g:~# service oracle-xe stop
Shutting down Oracle Database 11g Express Edition instance.
Stopping Oracle Net Listener.
root@orxe11g:~# sed -i -E "s/HOST = [^)]+/HOST = 0.0.0.0/g" /u01/app/oracle/product/11.2.0/xe/network/admin/listener.ora
root@orxe11g:~# service oracle-xe start
Starting Oracle Net Listener.
Starting Oracle Database 11g Express Edition instance.
- Now from your os (Windows for example), you can test it using SQLPlus
c:\oracle\instant_client_12_2_x64>echo select sysdate from dual; | sqlplus -s system/oracle@localhost:49133/XE
SYSDATE
---------
18-JUL-17
- Or test it using Python
import cx_Oracle
conn = cx_Oracle.connect('system', 'oracle', 'localhost:49133/XE')
cursor = conn.cursor()
cursor.execute("SELECT SYSDATE FROM DUAL")
print(cursor.fetchone())
cursor.close()
conn.close()
$ python docker-oracle-tests.py
(datetime.datetime(2017, 7, 18, 5, 4, 9),)