Oracle XE for rapid development
-
daggerok/oracle-xe
Oracle 11.2.0.2-xe Prebuilt DB (no volumes to commit and push containers)
-
daggerok/oracle:prebuiltdb
Oracle Database 11g Release 2 Express Edition: 11.2.0.2-xe
-
daggerok/oracle:xe -
daggerok/oracle:latest -
daggerok/oracle:12.1.0.2 -
daggerok/oracle:12.1.0.2-xe
Oracle Database 12c Release 1 Standard Edition (SE2): 12.1.0.2-se
-
daggerok/oracle:12.1.0.2-se2 -
daggerok/oracle:12.1.0.2-se -
daggerok/oracle:se2 -
daggerok/oracle:se -
daggerok/oracle
|
Note
|
you can build and prepare same image by yourselves. see details |
docker container run \
--shm-size=1g \
-p 8080:8080 -p 1521:1521 \
-it --name oracle-xe \
daggerok/oracle-xe|
Note
|
prebuilt SYSTEM username and password password.
|
Sometimes we wanna prepare our own Oracle Database with specific configurations or with some tests data included. But due to default Oracle Docker image VOLUME instructions we cannot just commit our container and reuse it later. To fix that issue, I have prepared something for you :)
|
Tip
|
Here a guide how you can use daggerok/oracle:prebuiltdb base image to create and quickly run your own reusable
containers
|
docker pull daggerok/oracle:prebuiltdbdocker container run \
--shm-size=1g \
-p 8080:8080 -p 1521:1521 \
-e ORACLE_PWD=password \
-it --name oracle-xe \
daggerok/oracle:prebuiltdbdocker container stop oracle-xedocker commit \
-a 'Maksim Kostromin <daggerok@gmail.com>' \
-m 'Oracle XE with credentials SYSTEM / password' \
oracle-xe daggerok/oracle-xe:latestdocker push daggerok/oracle-xe:latestdocker container run \
--shm-size=1g \
-p 8080:8080 -p 1521:1521 \
-it --name oracle-xe \
daggerok/oracle-xedocker run -d --rm \
--name oracle-xe \
--shm-size=1g \
-p 1521:1521 \
-e ORACLE_PWD=password \
daggerok/oracle:11.2.0.2-xe
# daggerok/oracle:11.2.0.2
# daggerok/oracle:xe
# daggerok/oracle
Parameters:
--name The name of the container (default: auto generated)
--shm-size Amount of Linux shared memory
-p The port mapping of the host port to the container port.
Two ports are exposed: 1521 (Oracle Listener), 8080 (APEX)
-e ORACLE_PWD The Oracle Database SYS, SYSTEM and PDB_ADMIN password (default: auto generated)
-v /u01/app/oracle/oradata
The data volume to use for the database.
Has to be writable by the Unix "oracle" (uid: 54321) user inside the container!
If omitted the database will not be persisted over container recreation.
-v /u01/app/oracle/scripts/startup | /docker-entrypoint-initdb.d
-v /u01/app/oracle/scripts/setup | /docker-entrypoint-initdb.d
Optional: A volume with custom scripts to be run after database startup.
For further details see the "Running scripts after setup and on startup" section below.
version: '2.1'
services:
oracle-xe:
image: daggerok/oracle
shm_size: 1g
environment:
ORACLE_PWD: password
APEX_PORT: 8080
ports:
- '1521:1521'
- '8080:8080'
networks: [backing-services]
healthcheck:
test: curl -uSYSTEM:$$ORACLE_PWD -v http://127.0.0.1:$$APEX_PORT//apex/
timeout: 2s
retries: 100
networks:
backing-services:
driver: bridge
version: "2.1"
services:
oracle-xe:
image: daggerok/oracle:11.2.0.2-xe
shm_size: 1g
environment:
ORACLE_PWD: password
ports:
- "1521:1521"
- "8080:8080"
volumes:
- "oracle-xe-data:/u01/app/oracle/oradata"
- "./db-startup-migration-scripts:/u01/app/oracle/scripts/startup"
- "./db-setup-migration-scripts:/docker-entrypoint-initdb.d/setup"
networks: [backing-services]
restart: unless-stopped
volumes:
oracle-xe-data: {}
networks:
backing-services:
driver: bridge
./migrations to /opt/oracle/migration-scripts which is then searched for custom startup scripts:docker run --rm --name oracle-xe \ -p 1521:1521 \ -v $PWD/migrations:/docker-entrypoint-initdb.d/startup \ -v /path/to/oradata:/u01/app/oracle/oradata \ daggerok/oracle:xe
docker run -d --rm --name oracle-se \
--shm-size=1g \
-p 1521:1521 \
-p 5500:5500 \
-e ORACLE_SID=ORCLCDB \
-e ORACLE_PWD=password \
-e ORACLE_PDB=ORCLPDB1 \
-e ORACLE_CHARACTERSET=AL32UTF8 \
daggerok/oracle:12.1.0.2-se2
# daggerok/oracle:12.1.0.2-se
# daggerok/oracle
Parameters:
--name The name of the container (default: auto generated)
--shm-size Amount of Linux shared memory
-p The port mapping of the host port to the container port.
Two ports are exposed: 1521 (Oracle Listener), 5500 (OEM Express)
-e ORACLE_SID The Oracle Database SID that should be used (default: ORCLCDB) The Oracle Database SYS, SYSTEM and PDB_ADMIN password (default: auto generated)
-e ORACLE_PWD The Oracle Database SYS, SYSTEM and PDB_ADMIN password (default: auto generated)
-e ORACLE_PDB The Oracle Database PDB name that should be used (default: ORCLPDB1)
-e ORACLE_CHARACTERSET
The character set to use when creating the database (default: AL32UTF8)
-v /opt/oracle/oradata
The data volume to use for the database.
Has to be writable by the Unix "oracle" (uid: 54321) user inside the container!
If omitted the database will not be persisted over container recreation.
-v /opt/oracle/scripts/startup | /docker-entrypoint-initdb.d
-v /opt/oracle/scripts/setup | /docker-entrypoint-initdb.d
Optional: A volume with custom scripts to be run after database startup.
For further details see the "Running scripts after setup and on startup" section below.version: "2.1"
services:
oracle-se:
image: daggerok/oracle
shm_size: 1g
environment:
ORACLE_PWD: password
ports: ["1521:1521"]
networks: [backing-services]
#healthcheck:
# test: curl -uSYSTEM:$$ORACLE_PWD -v http://127.0.0.1:8080//apex/
# interval: 15s
# timeout: 2s
# retries: 22
networks:
backing-services:
driver: bridgeversion: "2.1"
services:
oracle-se2:
image: daggerok/oracle:12.1.0.2-se2
shm_size: 1g
environment:
ORACLE_SID: xe
ORACLE_PWD: password
ports:
- "1521:1521"
- "5500:5500"
volumes:
- "oracle-se2-data:/opt/oracle/oradata"
- "./db-startup-migration-scripts:/opt/oracle/scripts/startup"
- "./db-setup-migration-scripts:/docker-entrypoint-initdb.d/setup"
networks: [backing-services]
restart: unless-stopped
volumes:
oracle-se2-data: {}
networks:
backing-services:
driver: bridge./migrations to /opt/oracle/migration-scripts which is then searched for custom startup scripts:docker run --rm --name oracle-se \
-p 1521:1521 \
-v $PWD/migrations:/opt/oracle/scripts/startup \
-v /home/oracle/oradata:/opt/oracle/oradata \
daggerok/oracle:12.1.0.2-se2sqlplus sys/<your password>@//localhost:1521/<your SID> as sysdba
sqlplus system/<your password>@//localhost:1521/<your SID>
sqlplus pdbadmin/<your password>@//localhost:1521/<Your PDB name>wget https://github.com/daggerok/oracle/releases/download/oracle/sqlplus-macos.x64-12.2.0.1.0-2.zip
unzip sqlplus-macos.x64-12.2.0.1.0-2.zip
export PATH=$PWD/sqlplus:$PATH
sqlplus -HV# docker run ... -e ORACLE_PWD=password ... daggerok/oracle:11.2.0.2-xe
sqlplus system/password@//0.0.0.0/XE
SQL*Plus: Release 12.2.0.1.0 Production on Tue Apr 24 21:38:50 2018
Copyright (c) 1982, 2017, Oracle. All rights reserved.
Connected to:
Oracle Database 11g Express Edition Release 11.2.0.2.0 - 64bit Production
SQL> select * from dual;
SQL> ...
SQL> quit
Disconnected from Oracle Database 11g Express Edition Release 11.2.0.2.0 - 64bit ProductionThe docker images can be configured to run scripts after setup and on startup. Currently sh and sql extensions are supported. For post-setup scripts just mount the volume /opt/oracle/scripts/setup or extend the image to include scripts in this directory. For post-startup scripts just mount the volume /opt/oracle/scripts/startup or extend the image to include scripts in this directory. Both of those locations are also represented under the symbolic link /docker-entrypoint-initdb.d. This is done to provide synergy with other database Docker images. The user is free to decide whether he wants to put his setup and startup scripts under /opt/oracle/scripts or /docker-entrypoint-initdb.d.
After the database is setup and/or started the scripts in those folders will be executed against the database in the container. SQL scripts will be executed as sysdba, shell scripts will be executed as the current user. To ensure proper order it is recommended to prefix your scripts with a number. For example, in Flyway-style:
-
V201711031__app_v1_initial_DDL.sql
-
V201711032__app_v1_initial_DML.sql
-
V201804021__app_v2_migration_scripts.sql
-
…
Note: The startup scripts will also be executed after the first time database setup is complete.
required running oracle in docker, sqlplus installed, bash / cygwin shell
# run oracle for example with ORACLE_PWD: password
# docker run ... -e ORACLE_PWD=password ... daggerok/oracle:11.2.0.2-xe
wget https://github.com/daggerok/oracle/releases/download/oracle/sqlplus-sample.zip
unzip -d /tmp sqlplus-sample.zip
bash /tmp/sqlplus-sample/sqlplus-cmd.bash
# verify that `my_app` username / password schema should contains groups and users tables...