NOTE: This has been successfully run but has not been fully tested. Some bugs may exist. Here be dragons, etc.
A Docker image with Oracle Database 11g Enterprise Edition Release 11.2.0.1.0 running in CentOS 6.6
- Default ORCL database on port 1521
- Install Docker
- You can no longer pull Oracle images from the Docker Hub, so you'll need to build it yourself
Create and run a container named orcl:
$ docker run --privileged -dP --name orcl wscherphof/oracle-12c
989f1b41b1f00c53576ab85e773b60f2458a75c108c12d4ac3d70be4e801b563
Yes, alas, this has to run privileged
in order to gain permission for the mount
statement in /tmp/start
that ups the amount of shared memory, which has a hard value of 64M in Docker; see this GitHub issue
The default password for the sys
user is change_on_install
, and for system
it's manager
The ORCL
database port 1521
is bound to the Docker host through run -P
. To find the host's port:
$ docker port orcl 1521
0.0.0.0:49189
So from the host, you can connect with system/manager@localhost:49189/orcl
Though if using Boot2Docker, you need the actual ip address instead of localhost
:
$ boot2docker ip
The VM's Host only interface IP address is: 192.168.59.103
If you're looking for a databse client, consider sqlplus
$ sqlplus system/[email protected]:49189/orcl
SQL*Plus: Release 11.2.0.4.0 Production on Mon Sep 15 14:40:52 2014
Copyright (c) 1982, 2013, Oracle. All rights reserved.
Connected to:
Oracle Database 12c Enterprise Edition Release 12.1.0.2.0 - 64bit Production
With the Partitioning, OLAP, Advanced Analytics and Real Application Testing options
SQL> |
The container runs a process that starts up the database, and then continues to check each minute if the database is still running, and start it if it's not. To see the output of that process:
$ docker logs orcl
LSNRCTL for Linux: Version 12.1.0.2.0 - Production on 16-SEP-2014 11:34:56
Copyright (c) 1991, 2014, Oracle. All rights reserved.
Starting /u01/app/oracle/product/12.1.0/dbhome_1/bin/tnslsnr: please wait...
TNSLSNR for Linux: Version 12.1.0.2.0 - Production
Log messages written to /u01/app/oracle/diag/tnslsnr/e90ad7cc75a1/listener/alert/log.xml
Listening on: (DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=e90ad7cc75a1)(PORT=1521)))
Connecting to (ADDRESS=(PROTOCOL=tcp)(HOST=)(PORT=1521))
STATUS of the LISTENER
------------------------
Alias LISTENER
Version TNSLSNR for Linux: Version 12.1.0.2.0 - Production
Start Date 16-SEP-2014 11:34:56
Uptime 0 days 0 hr. 0 min. 0 sec
Trace Level off
Security ON: Local OS Authentication
SNMP OFF
Listener Log File /u01/app/oracle/diag/tnslsnr/e90ad7cc75a1/listener/alert/log.xml
Listening Endpoints Summary...
(DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=e90ad7cc75a1)(PORT=1521)))
The listener supports no services
The command completed successfully
SQL*Plus: Release 12.1.0.2.0 Production on Tue Sep 16 11:34:56 2014
Copyright (c) 1982, 2014, Oracle. All rights reserved.
Connected to an idle instance.
ORACLE instance started.
Total System Global Area 1073741824 bytes
Fixed Size 2932632 bytes
Variable Size 721420392 bytes
Database Buffers 343932928 bytes
Redo Buffers 5455872 bytes
Database mounted.
Database opened.
Disconnected from Oracle Database 12c Enterprise Edition Release 12.1.0.2.0 - 64bit Production
With the Partitioning, OLAP, Advanced Analytics and Real Application Testing options
LSNRCTL for Linux: Version 12.1.0.2.0 - Production on 16-SEP-2014 11:35:24
Copyright (c) 1991, 2014, Oracle. All rights reserved.
Connecting to (ADDRESS=(PROTOCOL=tcp)(HOST=)(PORT=1521))
STATUS of the LISTENER
------------------------
Alias LISTENER
Version TNSLSNR for Linux: Version 12.1.0.2.0 - Production
Start Date 16-SEP-2014 11:34:56
Uptime 0 days 0 hr. 0 min. 28 sec
Trace Level off
Security ON: Local OS Authentication
SNMP OFF
Listener Log File /u01/app/oracle/diag/tnslsnr/e90ad7cc75a1/listener/alert/log.xml
Listening Endpoints Summary...
(DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=e90ad7cc75a1)(PORT=1521)))
Services Summary...
Service "ORCL" has 1 instance(s).
Instance "ORCL", status READY, has 1 handler(s) for this service...
The command completed successfully
There's no ssh daemon or similar configured in the image. If you need a command prompt inside the container, consider nsenter (and mind the Boot2Docker note there)
Should you want to modify & build your own image:
-
Download
linux.x64_11gR2_database_1of2.zip
&linux.x64_11gR2_database_2of2.zip
from Oracle Tech Net -
Put the 2 zip files in the
step1
directory -
cd
to theoracle-11g
repo directory -
$ docker build -t oracle-11g:step1 step1
-
$ docker run --privileged -ti --name step1 oracle-11g:step1 /bin/bash
-
# /tmp/install/install
(takes about 5m)
Wed Jul 22 16:29:58 UTC 2015
Starting Oracle Universal Installer...
Checking Temp space: must be greater than 120 MB. Actual 125233 MB Passed
Checking swap space: must be greater than 150 MB. Actual 6141 MB Passed
Preparing to launch Oracle Universal Installer from /tmp/OraInstall2015-07-22_04-29-58PM. Please wait ...[root@cf45cfa558d2 /]# You can find the log of this install session at:
/u01/app/oraInventory/logs/installActions2015-07-22_04-29-58PM.log
The following configuration scripts need to be executed as the "root" user.
#!/bin/sh
#Root scripts to run
/u01/app/oracle/product/11.2.0/dbhome_1/root.sh
To execute the configuration scripts:
1. Open a terminal window
2. Log in as "root"
3. Run the scripts
4. Return to this window and hit "Enter" key to continue
Successfully Setup Software.
-
<enter>
-
# exit
(the scripts mentioned are executed as part of the step2 build) -
$ docker commit step1 oracle-11g:installed
-
$ docker build -t oracle-11g:step2 step2
-
$ docker run --privileged -ti --name step2 oracle-11g:step2 /bin/bash
-
# /tmp/create
(takes about 15m)
Wed Jul 22 16:37:18 UTC 2015
Creating database...
SQL*Plus: Release 11.2.0.1.0 Production on Wed Jul 22 16:37:18 2015
Copyright (c) 1982, 2009, Oracle. All rights reserved.
Connected to an idle instance.
File created.
ORACLE instance started.
Total System Global Area 1068937216 bytes
Fixed Size 2220200 bytes
Variable Size 616566616 bytes
Database Buffers 444596224 bytes
Redo Buffers 5554176 bytes
Database created.
Tablespace created.
Tablespace created.
Disconnected from Oracle Database 11g Enterprise Edition Release 11.2.0.1.0 - 64bit Production
With the Partitioning, OLAP, Data Mining and Real Application Testing options
Wed Jul 22 16:37:44 UTC 2015
Running catalog.sql...
Wed Jul 22 16:38:27 UTC 2015
Running catproc.sql...
Wed Jul 22 16:44:14 UTC 2015
Running pupbld.sql...
Finalizing install and shutting down the database...
SQL*Plus: Release 11.2.0.1.0 Production on Wed Jul 22 16:44:15 2015
Copyright (c) 1982, 2009, Oracle. All rights reserved.
Connected to:
Oracle Database 11g Enterprise Edition Release 11.2.0.1.0 - 64bit Production
With the Partitioning, OLAP, Data Mining and Real Application Testing options
BEGIN dbms_xdb_config.sethttpsport(5500); END;
*
ERROR at line 1:
ORA-06550: line 1, column 7:
PLS-00201: identifier 'DBMS_XDB_CONFIG.SETHTTPSPORT' must be declared
ORA-06550: line 1, column 7:
PL/SQL: Statement ignored
BEGIN dbms_xdb_config.sethttpport(8080); END;
*
ERROR at line 1:
ORA-06550: line 1, column 7:
PLS-00201: identifier 'DBMS_XDB_CONFIG.SETHTTPPORT' must be declared
ORA-06550: line 1, column 7:
PL/SQL: Statement ignored
Database closed.
Database dismounted.
ORACLE instance shut down.
Disconnected from Oracle Database 11g Enterprise Edition Release 11.2.0.1.0 - 64bit Production
With the Partitioning, OLAP, Data Mining and Real Application Testing options
Wed Jul 22 16:44:24 UTC 2015
Create is done; commit the container now
-
# exit
-
$ docker commit step2 oracle-11g:created
$ docker build -t oracle-11g step3
GNU Lesser General Public License (LGPL) for the contents of this GitHub repo; for Oracle's database software, see their Licensing Information