A Docker image with Oracle Database 12c Enterprise Edition Release 12.1.0.2.0 running in Oracle Linux 7
- Default ORCL database on port 1521
- Install Docker
$ docker pull wscherphof/oracle-xe-11g-r2
Create and run a container named db:
$ 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 db
Fri Sep 12 20:04:48 UTC 2014
SQL*Plus: Release 12.1.0.2.0 Production on Fri Sep 12 20:04:49 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 696254568 bytes
Database Buffers 369098752 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 12-SEP-2014 20:05:18
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 12-SEP-2014 20:04:48
Uptime 0 days 0 hr. 0 min. 29 sec
Trace Level off
Security ON: Local OS Authentication
SNMP OFF
Listener Log File /u01/app/oracle/diag/tnslsnr/6568827caac6/listener/alert/log.xml
Listening Endpoints Summary...
(DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=6568827caac6)(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 deamon 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 & unzip the Oracle install package (2 files) from Oracle Tech Net; this will get you a
database
folder - Put the
database
folder under thestep1
folder cd
to thestep1
folder$ docker build -t oracle-12c:step1 .
$ docker run --privileged -ti --name step1 oracle-12c:step1 /bin/bash
-$ . /tmp/shm
-$ . /tmp/install
(takes about 5m)-$ exit
$ docker commit step1 oracle_12c:installed
$ cd ../step2
$ docker build -t oracle-12c:step2 .
$ docker run --privileged -ti --name step2 oracle-12c:step2 /bin/bash
-$ /tmp/create
(takes about 15m)-$ exit
$ docker commit step2 oracle_12c:created
$ cd ../step3
$ docker build -t oracle-12c .