diff --git a/.github/workflows/docker-image.yml b/.github/workflows/docker-image.yml new file mode 100644 index 0000000..2be9c25 --- /dev/null +++ b/.github/workflows/docker-image.yml @@ -0,0 +1,39 @@ +name: Publish Docker image + +on: + release: + types: [ "published" ] + +jobs: + push_to_registry: + name: Push Docker image to Docker Hub + runs-on: ubuntu-latest + steps: + - name: Check out the repo + uses: actions/checkout@v4 + - name: Log in to Docker Hub + uses: docker/login-action@v3 + with: + username: ${{ secrets.DOCKER_USERNAME }} + password: ${{ secrets.DOCKER_PASSWORD }} + - name: Log in to Oracle Container Registry + uses: docker/login-action@v3 + with: + registry: container-registry.oracle.com + username: ${{ secrets.ORACLE_USERNAME }} + password: ${{ secrets.ORACLE_PASSWORD }} + - name: Extract metadata (tags, labels) for Docker + id: meta + uses: docker/metadata-action@v5 + with: + images: scalified/oracle-database + tags: | + type=ref,event=tag + - name: Build and push Docker image + uses: docker/build-push-action@v5 + with: + context: . + push: true + tags: ${{ steps.meta.outputs.tags }} + labels: ${{ steps.meta.outputs.labels }} + diff --git a/.gitmodules b/.gitmodules deleted file mode 100644 index 8c5b705..0000000 --- a/.gitmodules +++ /dev/null @@ -1,3 +0,0 @@ -[submodule "oracle-docker-images"] - path = oracle-docker-images - url = https://github.com/oracle/docker-images.git diff --git a/11g-r2/Dockerfile b/11g-r2/Dockerfile deleted file mode 100644 index 2b8f82d..0000000 --- a/11g-r2/Dockerfile +++ /dev/null @@ -1,4 +0,0 @@ -FROM alexeiled/docker-oracle-xe-11g - -ADD init.sql /etc/entrypoint-initdb.d/ - diff --git a/11g-r2/init.sql b/11g-r2/init.sql deleted file mode 100644 index fc70a2c..0000000 --- a/11g-r2/init.sql +++ /dev/null @@ -1,11 +0,0 @@ -ALTER PROFILE DEFAULT LIMIT PASSWORD_REUSE_TIME UNLIMITED -; -ALTER PROFILE DEFAULT LIMIT PASSWORD_LIFE_TIME UNLIMITED -; -ALTER PROFILE DEFAULT LIMIT PASSWORD_GRACE_TIME UNLIMITED -; - -CREATE USER scalified IDENTIFIED BY 123456 -; -GRANT ALL PRIVILEGES TO scalified -; diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000..c691045 --- /dev/null +++ b/Dockerfile @@ -0,0 +1,10 @@ +FROM container-registry.oracle.com/database/enterprise:19.3.0.0 + +ENV ORACLE_SCRIPTS_PATH /opt/scripts + +ENV PATH "$PATH:$ORACLE_SCRIPTS_PATH" + +COPY setup /opt/oracle/scripts/setup + +COPY scripts /opt/scripts + diff --git a/README.md b/README.md index 65a6468..d863686 100644 --- a/README.md +++ b/README.md @@ -1,4 +1,4 @@ -# Oracle Database Docker +# Docker Oracle Database [![Docker Pulls](https://img.shields.io/docker/pulls/scalified/oracle-database.svg)](https://hub.docker.com/r/scalified/oracle-database) [![](https://images.microbadger.com/badges/image/scalified/oracle-database.svg)](https://microbadger.com/images/scalified/oracle-database) @@ -6,63 +6,32 @@ ## Description -This repository is used for building a [**Docker**](https://www.docker.com) image containing [**Oracle Database**](https://www.oracle.com/database/index.html) +This repository contains an official [**Oracle Database**](https://container-registry.oracle.com/ords/f?p=113:4:113443227637136:::4:P4_REPOSITORY,AI_REPOSITORY,AI_REPOSITORY_NAME,P4_REPOSITORY_NAME,P4_EULA_ID,P4_BUSINESS_AREA_ID:9,9,Oracle%20Database%20Enterprise%20Edition,Oracle%20Database%20Enterprise%20Edition,1,0&cs=3ngPvo9IXPi_O4ZXhv09DqTdDeSyjEdM9Bllql6pu2wJzhQdAu8XltTmhgof2DCjvAGrBWeSfyWTMj3xRtT3yQw) images with additional scripts ## Official Documentation +* [Oracle Database Container Registry](https://container-registry.oracle.com/ords/f?p=113:4:113443227637136:::4:P4_REPOSITORY,AI_REPOSITORY,AI_REPOSITORY_NAME,P4_REPOSITORY_NAME,P4_EULA_ID,P4_BUSINESS_AREA_ID:9,9,Oracle%20Database%20Enterprise%20Edition,Oracle%20Database%20Enterprise%20Edition,1,0&cs=3ngPvo9IXPi_O4ZXhv09DqTdDeSyjEdM9Bllql6pu2wJzhQdAu8XltTmhgof2DCjvAGrBWeSfyWTMj3xRtT3yQw) * [Creating an Oracle Database Docker image](https://blogs.oracle.com/developer/entry/creating_and_oracle_database_docker) * [Oracle Database Software Downloads](http://www.oracle.com/technetwork/database/enterprise-edition/downloads/index.html) -* [Docker Images from Oracle](https://github.com/oracle/docker-images) +* [Docker Images from Oracle](https://github.com/oracle/docker-images)* [Creating an Oracle Database Docker image](https://blogs.oracle.com/developer/entry/creating_and_oracle_database_docker) ## Dockerhub -**`docker pull scalified/oracle-database:`** +`docker pull scalified/oracle-database:` | Version | Description | |-----------------------------|-------------------------------| -| **11g-r2** | 11g Release 2 Express Edition | +| **19.3.0.0-ee** | 19.3.0.0 Enterprise Edition | | **12.2.0.1-ee** | 12.2.0.1 Enterprise Edition | | **12.1.0.2-se2** | 12.1.0.2 Standard Edition | | **12.1.0.2-ee** | 12.1.0.2 Enterprise Edition | - -## Oracle 11.x Releases - -Currently only 11g Release 2 is supported +| **11g-r2** | 11g Release 2 Express Edition | ### Running Container -``` -docker run -it --name oracle -p 1521:1521 scalified/oracle-database: -``` - -### Connection Settings - -#### JDBC URL - -``` -jdbc:oracle:thin:@//localhost:1521/xe -``` - -#### Credentials - -| User | Password | Description | -|-----------|----------|--------------| -| system | oracle | System user | -| sys | oracle | System user | -| scalified | 123456 | Regular user | - -## Oracle 12.x Releases +`docker run -it --name oracle -p 1521:1521 scalified/oracle-database:` -### Building Docker Images - -1. Increase Docker container size by adding the following option to the daemon start: - **`--storage-opt dm.basesize=20G`** -2. Download Oracle installation files from [Oracle Database Software Downloads](http://www.oracle.com/technetwork/database/enterprise-edition/downloads/index.html) -3. Put downloaded files from *step 2* into the correspondent Oracle version folder in the: - **`oracle-docker-images/OracleDatabase/dockerfiles`** -4. Proceed with [official building instructions](https://github.com/oracle/docker-images/tree/master/OracleDatabase#building-oracle-database-docker-install-images) - -### Connecting to Database +### Connecting to the Database Once the container has been started and the database created you can connect to it just like to any other database: @@ -73,48 +42,27 @@ sqlplus sys/@//localhost:1521/ as sysdba sqlplus pdbadmin/@//localhost:1521/ ``` -### Database Configuration - -#### Default Admin Accounts Passwords - -On the first startup of the container a random password is generated for the database and shown in log message: - -`ORACLE AUTO GENERATED PASSWORD FOR SYS, SYSTEM AND PDBAMIN: ` - -#### Creating a User Inside Pluggable Database +#### Creating PDB ```sql -CREATE USER IDENTIFIED BY -; -GRANT ALL PRIVILEGES TO -; -``` - -#### Creating Pluggable Database - -```sql -CREATE PLUGGABLE DATABASE ADMIN USER IDENTIFIED BY - FILE_NAME_CONVERT=('/opt/oracle/oradata//pdbseed/','/opt/oracle/oradata//') -; -ALTER PLUGGABLE DATABASE OPEN -; -ALTER PLUGGABLE DATABASE SAVE STATE -; +docker exec create-pdb.sh ``` where: -* **\** - pluggable database name to create -* **\** - container database name (**SID**) +* `` - PDB name +* `` - PDB username +* `` - PDB password #### Changing Enterprise Manager Endpoint Check the listener status: -```cmd -lsnrctl status -``` + +`lsnrctl status` + This will output endpoints: -```cmd + +``` ... Listening Endpoints Summary... (DESCRIPTION=(ADDRESS=(PROTOCOL=ipc)(KEY=EXTPROC1))) @@ -122,7 +70,9 @@ Listening Endpoints Summary... (DESCRIPTION=(ADDRESS=(PROTOCOL=tcps)(HOST=67e0ca534f7b)(PORT=5500))(Presentation=HTTP)(Session=RAW)) ... ``` + Login to sql as sysdba and execute procedure: + ```sql exec dbms_xdb_config.setListenerEndPoint(dbms_xdb_config.xdb_endpoint_http2, '67e0ca534f7b', 5500, dbms_xdb_config.xdb_protocol_tcp); ``` @@ -133,6 +83,7 @@ https://www.morganslibrary.org/reference/pkgs/dbms_xdb_config.html ``` Setting EM ports: + ```sql exec DBMS_XDB_CONFIG.SETHTTPSPORT(5500); exec DBMS_XDB_CONFIG.SETHTTPPORT(5510); @@ -149,4 +100,5 @@ echo "SQLNET.INBOUND_CONNECT_TIMEOUT=0" >> $ORACLE_HOME/network/admin/sqlnet.ora * [Scalified](http://www.scalified.com) * [Scalified Official Facebook Page](https://www.facebook.com/scalified) -* Scalified Support +* Scalified Support + diff --git a/oracle-docker-images b/oracle-docker-images deleted file mode 160000 index 7091576..0000000 --- a/oracle-docker-images +++ /dev/null @@ -1 +0,0 @@ -Subproject commit 7091576e0eb08ea75abeb6d6bf2ca632b6731b36 diff --git a/scripts/create-pdb.sh b/scripts/create-pdb.sh new file mode 100755 index 0000000..ee225b9 --- /dev/null +++ b/scripts/create-pdb.sh @@ -0,0 +1,14 @@ +#!/bin/env bash + +DB_NAME="$1" +USERNAME="$2" +PASSWORD="$3" + +SCRIPT_DIR=$(dirname "$(readlink -f "$0")") + +sqlplus -S /nolog <