Showing posts with label Oracle. Show all posts
Showing posts with label Oracle. Show all posts

Wednesday, April 3, 2024

Install free Docker Oracle database

HOWTO
Login to Oracle Docker Registry (OCR)  web and create auth token 


Login to  OCR 
Use auth token created on OCR web 
$ docker login container-registry.oracle.com

Download Oracle free db image
$ docker pull container-registry.oracle.com/database/free:latest
latest: Pulling from database/free
089fdfcd47b7: Pull complete 
43c899d88edc: Pull complete 
47aa6f1886a1: Pull complete 
f8d07bb55995: Pull complete 
c31c8c658c1e: Pull complete 
b7d28faa08b4: Pull complete 
1d0d5c628f6f: Pull complete 
db82a695dad3: Pull complete 
25a185515793: Pull complete 
Digest: sha256:5ac0efa9896962f6e0e91c54e23c03ae8f140cf6ed43ca09ef4354268a942882
Status: Downloaded newer image for container-registry.oracle.com/database/free:latest
container-registry.oracle.com/database/free:latest

Start container
$ docker run -it  -d --name oracle  -e ORACLE_PWD=weblogic123 -p1521:1521 container-registry.oracle.com/database/free
6855a46bc9dab584a190950695866692a1d0b911876924b8f98ad48664de3845


$ docker ps
CONTAINER ID   IMAGE                                         COMMAND                  CREATED          STATUS                             PORTS                                       NAMES
93b8809b1204   container-registry.oracle.com/database/free   "/bin/bash -c $ORACL…"   41 seconds ago   Up 38 seconds (health: starting)   0.0.0.0:1521->1521/tcp, :::1521->1521/tcp   oracle




How to Use Custom Configuration Parameters for the Database on Docker

The Oracle Database Docker image enables you to customize the configuration of your database, and to provide initialization parameters for when the database starts.

Oracle Database server container also provides configuration parameters that can be used when starting the container. The following example provides the syntax for a detailed docker run command supporting all custom configurations, with variable values in Italics font, which you can replace with values for your deployment:

For further details see the "Running scripts after setup and on startup" section belotall Oracle sqplus clienInI$ sudo dnf install oracle-instantclient-basic-21.13.0.0.0-1.el8.x86_64.rpm
  $ sudo dnf install oracle-instantclient-sqlplus-21.13.0.0.0-1.el8.x86_64.rpm 


Connect to Oracle Docker db
$ docker exec -it oracle sqlplus / as sysdba

SQL*Plus: Release 23.0.0.0.0 - Production on Wed Apr 3 10:28:37 2024
Version 23.3.0.23.09

Copyright (c) 1982, 2023, Oracle.  All rights reserved.


Connected to:
Oracle Database 23c Free Release 23.0.0.0.0 - Develop, Learn, and Run for Free
Version 23.3.0.23.09

SQL> 

Create Oracle db user - connect to Docker container as sysdba
SQL> alter session set "_ORACLE_SCRIPT"=true;

Session altered.

SQL> CREATE USER dave IDENTIFIED BY weblogic123;

User created.

SQL> GRANT CONNECT, RESOURCE, DBA TO dave;

Grant succeeded.

Connect via sqlplus
sqlplus dave@localhost:1521/FREE

SQL*Plus: Release 21.0.0.0.0 - Production on Wed Apr 3 19:47:37 2024
Version 21.13.0.0.0

Copyright (c) 1982, 2022, Oracle.  All rights reserved.

Enter password: 

Connected to:
Oracle Database 23c Free Release 23.0.0.0.0 - Develop, Learn, and Run for Free
Version 23.3.0.23.09

SQL> 

sqlplus dave@localhost:1521/FREE

SQL*Plus: Release 21.0.0.0.0 - Production on Wed Apr 3 19:47:37 2024
Version 21.13.0.0.0

Copyright (c) 1982, 2022, Oracle.  All rights reserved.

Enter password: 

Connected to:
Oracle Database 23c Free Release 23.0.0.0.0 - Develop, Learn, and Run for Free
Version 23.3.0.23.09

SQL> 


Friday, December 15, 2023

Pull Docker images from Oracle Container Registry - Weblogic k8s Operator

 HOWTO



Prepare domain - create Oracle container registry secret

  1. Accept the license agreement for WebLogic Server images.

    a. In a browser, go to the Oracle Container Registry (OCR) and log in using the Oracle Single Sign-On (SSO) authentication service. If you do not already have SSO credentials, then at the top, right side of the page, click Sign In to create them.

    b. Search for weblogic, then select weblogic in the Search Results.

    c. From the drop-down menu, select your language and click Continue.

    d. Then read and accept the license agreement.

  2. Create a docker-registry secret to enable pulling the example WebLogic Server image from the registry.

    $ kubectl create secret docker-registry weblogic-repo-credentials \
         --docker-server=container-registry.oracle.com \
         --docker-username=YOUR_REGISTRY_USERNAME \
         --docker-password=YOUR_REGISTRY_PASSWORD \
         --docker-email=YOUR_REGISTRY_EMAIL \
         -n sample-domain1-ns
    

    Replace YOUR_REGISTRY_USERNAMEYOUR_REGISTRY_PASSWORD - use AUTHTOKEN, not password, and YOUR_REGISTRY_EMAIL with the values you use to access the registry.



Product Homeand Oracle Linux versionDated TagNon Dated Tag (latest)
Oracle WebLogic Server 14.1.1.0 Generic Installation11.0.21 + Oracle Linux 7u914.1.1.0-11-23071814.1.1.0-11
Oracle WebLogic Server 14.1.1.0 Generic Installation11.0.21 + Oracle Linux 8u414.1.1.0-11-ol8-23071814.1.1.0-11-ol8












Pull Docker Weblogic 14.1.1 image from OCR
$ docker pull container-registry.oracle.com/middleware/weblogic:14.1.1.0
14.1.1.0: Pulling from middleware/weblogic
cd17e56c322c: Pull complete 
159378624825: Pull complete 
c04549775f16: Pull complete 
3843b8b6117a: Pull complete 
8c356b9f7aaa: Pull complete 
800aaf7a8639: Pull complete 
Digest: sha256:1b5c18b921fdc8367c07b5feb38189da06e7cb6d519ca125c7c50794e0ec2b29
Status: Downloaded newer image for container-registry.oracle.com/middleware/weblogic:14.1.1.0
container-registry.oracle.com/middleware/weblogic:14.1.1.0

Downloaded image
$ docker images
REPOSITORY                                                TAG                   IMAGE ID       CREATED         SIZE
container-registry.oracle.com/middleware/weblogic         14.1.1.0              17f98eb6bba3   3 years ago     1.33GB

Saturday, October 15, 2022

Remove deprecated Oracle JDBC classes oracle.sql.ArrayDescriptor, oracle.sql.STRUCT, oracle.sql.StructDescriptor

 HOWTO

 
 
package dave.service;

import java.sql.Array;
import java.sql.Connection;
import java.sql.SQLException;
import java.sql.Struct;

import javax.annotation.sql.DataSourceDefinition;
import javax.ejb.Stateless;
import javax.persistence.EntityManager;
import javax.persistence.PersistenceContext;

import dave.entity.Account;
import oracle.jdbc.OracleConnection;
import oracle.sql.ArrayDescriptor;
import oracle.sql.SQLName;
import oracle.sql.STRUCT;
import oracle.sql.StructDescriptor;

@Stateless
//Data Source defined for JPA. It assume the derby database is started up and listen to localhost:1527
@DataSourceDefinition(name = "java:module/env/mavenArchetypeDataSource", className = "org.apache.derby.jdbc.ClientXADataSource", portNumber = 1527, serverName = "localhost", databaseName = "examples", user = "examples", password = "examples", properties = {
        "create=true", "weblogic.TestTableName=SQL SELECT 1 FROM SYS.SYSTABLES" })
public class AccountManagerImpl implements AccountManager {

    @PersistenceContext
    private EntityManager em;

    public void depositOnAccount(String name, float amount) {
        Account account = em.find(Account.class, name);
        if (account == null) {
            account = new Account();
            account.setName(name);
        }
        account.setAmount(account.getAmount() + amount);
        em.persist(account);
    }

    public Account findAccount(String name) {

        em.getTransaction().begin();
        Connection connection = em.unwrap(java.sql.Connection.class);

        try {
            useDeprecatedOracleConnection(connection);
        } catch (SQLException e) {
            e.printStackTrace();
        }

        try {
            useOracleConnection(connection);
        } catch (SQLException e) {
            e.printStackTrace();
        }

        return em.find(Account.class, name);
    }

    private void useDeprecatedOracleConnection(java.sql.Connection connection) throws SQLException {

        OracleConnection oracleConnection = null;

        if (connection.isWrapperFor(OracleConnection.class)) {
            oracleConnection = connection.unwrap(OracleConnection.class);
        } else {
            // recover, not an oracle connection
        }

        Object[] reportArray = new Object[3];
        STRUCT[] struct = new STRUCT[1];

        ArrayDescriptor arrayDescriptor = new ArrayDescriptor(
                new SQLName("T_REPORT_TABLE", (OracleConnection) connection), connection);
        StructDescriptor structDescriptor = StructDescriptor.createDescriptor("R_REPORT_OBJECT", connection);

        oracle.sql.ARRAY reportsArray = new oracle.sql.ARRAY(arrayDescriptor, connection, struct);

    }

    private void useOracleConnection(java.sql.Connection connection) throws SQLException {

        OracleConnection oracleConnection = null;

        if (connection.isWrapperFor(OracleConnection.class)) {
            oracleConnection = connection.unwrap(OracleConnection.class);
        } else {
            // recover, not an oracle connection
        }

        Object[] reportArray = new Object[3];
        Struct[] struct = new Struct[1];

        int arrayIndex = 0;

        struct[arrayIndex++] = connection.createStruct("R_REPORT_OBJECT", reportArray);

        Array reportsArray = ((OracleConnection) connection).createOracleArray("T_REPORT_TABLE", struct);

    }
}

Wednesday, October 7, 2020

Create Weblogic 12.2.1.4 Docker image with Oracle JDK 8 - using Oracle offical Docker image repository

This is using official Oracle Docker image repo

 For own Centos 8 images see https://danielveselka.blogspot.com/2021/02/create-centos-8-oracle-jdk-docker-image.html

 

Clone Oracle Docker image repo

https://github.com/oracle/docker-images/tree/master/OracleWebLogic

 

Alternatively download Weblogic image from Oracle Docker repository

https://container-registry.oracle.com/

https://www.middlewareinventory.com/blog/weblogic-docker/

 

See https://github.com/bzon/docker-oracle-weblogic for Docker compose sample 

https://github.com/bzon/docker-oracle-weblogic/blob/master/OracleWeblogic/weblogic-samples/1221-app-jms-domain/docker-compose.yml

On Fedora 31+ modify Docker installation 

https://fedoramagazine.org/docker-and-fedora-32/

Downloads

Build Oracle JDK 8 Docker image

Build Weblogic Server image

./buildDockerImage.sh -hUsage: buildDockerImage.sh -v [version] [-d | -g | -m ] [-j] [-s] [-c]
Builds a Docker Image for Oracle WebLogic.Parameters:
   -v: version to build. Required.
       Choose one of: 12.1.3  12.2.1.3  12.2.1.4  14.1.1.0
   -d: creates image based on 'developer' distribution
   -g: creates image based on 'generic' distribution
   -j: choose '8' to create a 14.1.1.0 image with JDK 8 or '11' to create a 14.1.1.0 image with JDK 11.
   -m: creates image based on 'slim' distribution
   -c: enables Docker image layer cache during build
   -s: skips the MD5 check of packages* select one distribution only: -d, -g, or -mLICENSE UPL 1.0Copyright (c) 2014, 2020, Oracle and/or its affiliates.

 

./buildDockerImage.sh -v 12.2.1.4 -g
Set- WebLogic's Version 12.2.1.4
Set- Distribution:Generic
Version= 12.2.1.4 Distribution= generic
Checking if required packages are present and valid...
fmw_12.2.1.4.0_wls_lite_Disk1_1of1.zip: OK
md5sum: WARNING: 1 line is improperly formatted
=====================
Proxy settings were found and will be used during build.
Building image 'oracle/weblogic:12.2.1.4-generic' ...
Building image using Dockerfile.'generic'
Sending build context to Docker daemon  607.2MB
Step 1/19 : FROM oracle/serverjre:8 as builder
 ---> b12cce0cdc47
Step 2/19 : LABEL "provider"="Oracle"                                                     "maintainer"="Monica Riccelli <monica.riccelli@oracle.com>"             "issues"="https://github.com/oracle/docker-images/issues"               "port.admin.listen"="7001"                                              "port.administration"="9002"
 ---> Running in f8d99a88a5ad
Removing intermediate container f8d99a88a5ad
 ---> d736736d476b
Step 3/19 : ENV ORACLE_HOME=/u01/oracle     USER_MEM_ARGS="-Djava.security.egd=file:/dev/./urandom"     PATH=$PATH:${JAVA_HOME}/bin:/u01/oracle/oracle_common/common/bin:/u01/oracle/wlserver/common/bin
 ---> Running in 3f2ececaf11a
Removing intermediate container 3f2ececaf11a
 ---> 146b8fcd883b
Step 4/19 : RUN mkdir /u01 &&     useradd -b /u01 -d /u01/oracle -m -s /bin/bash oracle &&     chown oracle:root -R /u01 &&     chmod -R 775 /u01
 ---> Running in b0d432006afd
Removing intermediate container b0d432006afd
 ---> cf3b48c68fd8
Step 5/19 : ENV FMW_PKG=fmw_12.2.1.4.0_wls_lite_Disk1_1of1.zip     FMW_JAR=fmw_12.2.1.4.0_wls_lite_generic.jar
 ---> Running in cef80193cca1
Removing intermediate container cef80193cca1
 ---> 61d8ae7b497c
Step 6/19 : COPY --chown=oracle:root $FMW_PKG install.file oraInst.loc /u01/
 ---> 54d99177fc67
Step 7/19 : USER oracle
 ---> Running in 93ef6bacad54
Removing intermediate container 93ef6bacad54
 ---> 97b07f62eaf0
Step 8/19 : RUN cd /u01 && ${JAVA_HOME}/bin/jar xf /u01/$FMW_PKG && cd - &&     ${JAVA_HOME}/bin/java -jar /u01/$FMW_JAR -silent -responseFile /u01/install.file -invPtrLoc /u01/oraInst.loc -jreLoc $JAVA_HOME -ignoreSysPrereqs -force -novalidation ORACLE_HOME=$ORACLE_HOME INSTALL_TYPE="WebLogic Server" &&     rm /u01/$FMW_JAR /u01/$FMW_PKG /u01/install.file &&     rm -rf /u01/oracle/cfgtoollogs
 ---> Running in 2b8c2e927247
/
Launcher log file is /tmp/OraInstall2020-10-06_04-32-43PM/launcher2020-10-06_04-32-43PM.log.
Extracting the installer . . . . . . Done
Checking if CPU speed is above 300 MHz.   Actual 2299.892 MHz    Passed
Checking swap space: must be greater than 512 MB.   Actual 0 MB    Failed <<<<
Checking if this platform requires a 64-bit JVM.   Actual 64    Passed (64-bit not required)
Checking temp space: must be greater than 300 MB.   Actual 35308 MB    Passed>>> Ignoring failure(s) of required prerequisite checks and continuing.
Preparing to launch the Oracle Universal Installer from /tmp/OraInstall2020-10-06_04-32-43PM
Log: /tmp/OraInstall2020-10-06_04-32-43PM/install2020-10-06_04-32-43PM.log
Setting ORACLE_HOME...
Setting INSTALL_TYPE...
Copyright (c) 1996, 2019, Oracle and/or its affiliates. All rights reserved.
Reading response file..
Skipping Software Updates
Validations are disabled for this session.
Verifying data
Copying Files
Percent Complete : 10
Percent Complete : 20
Percent Complete : 30
Percent Complete : 40
Percent Complete : 50
Percent Complete : 60
Percent Complete : 70
Percent Complete : 80
Percent Complete : 90
Percent Complete : 100The installation of Oracle Fusion Middleware 12c WebLogic Server and Coherence 12.2.1.4.0 completed successfully.
Logs successfully copied to /u01/oracle/.inventory/logs.
Removing intermediate container 2b8c2e927247
 ---> d7a4e153f899
Step 9/19 : FROM oracle/serverjre:8
 ---> b12cce0cdc47
Step 10/19 : ENV ORACLE_HOME=/u01/oracle     USER_MEM_ARGS="-Djava.security.egd=file:/dev/./urandom"     SCRIPT_FILE=/u01/oracle/createAndStartEmptyDomain.sh     HEALTH_SCRIPT_FILE=/u01/oracle/get_healthcheck_url.sh     PATH=$PATH:${JAVA_HOME}/bin:/u01/oracle/oracle_common/common/bin:/u01/oracle/wlserver/common/bin
 ---> Running in 431e04896ee9
Removing intermediate container 431e04896ee9
 ---> eb2f7f4b28c6
Step 11/19 : ENV DOMAIN_NAME="${DOMAIN_NAME:-base_domain}"     ADMIN_LISTEN_PORT="${ADMIN_LISTEN_PORT:-7001}"     ADMIN_NAME="${ADMIN_NAME:-AdminServer}"     ADMINISTRATION_PORT_ENABLED="${ADMINISTRATION_PORT_ENABLED:-true}"     ADMINISTRATION_PORT="${ADMINISTRATION_PORT:-9002}"
 ---> Running in 63039f801c73
Removing intermediate container 63039f801c73
 ---> 81f866830975
Step 12/19 : RUN mkdir -p /u01 &&     chmod 775 /u01 &&     useradd -b /u01 -d /u01/oracle -m -s /bin/bash oracle &&     chown oracle:root /u01
 ---> Running in 0d343b7ba4a1
Removing intermediate container 0d343b7ba4a1
 ---> 313342ac76f6
Step 13/19 : COPY --from=builder --chown=oracle:root /u01 /u01
 ---> 78f69917697e
Step 14/19 : COPY container-scripts/createAndStartEmptyDomain.sh container-scripts/create-wls-domain.py container-scripts/get_healthcheck_url.sh /u01/oracle/
 ---> 50da8dbcf889
Step 15/19 : RUN chmod +xr $SCRIPT_FILE $HEALTH_SCRIPT_FILE &&     chown oracle:root $SCRIPT_FILE /u01/oracle/create-wls-domain.py $HEALTH_SCRIPT_FILE
 ---> Running in d99c49d10e81
Removing intermediate container d99c49d10e81
 ---> d92ddd8d7375
Step 16/19 : USER oracle
 ---> Running in 453e1dfee2ef
Removing intermediate container 453e1dfee2ef
 ---> 1d89d8a52ac8
Step 17/19 : HEALTHCHECK --start-period=10s --timeout=30s --retries=3  CMD curl -k -s --fail `$HEALTH_SCRIPT_FILE` || exit 1
 ---> Running in 57809c715f24
Removing intermediate container 57809c715f24
 ---> 209494bd4b6c
Step 18/19 : WORKDIR ${ORACLE_HOME}
 ---> Running in a82dc96b8ddc
Removing intermediate container a82dc96b8ddc
 ---> 8ab075250e2f
Step 19/19 : CMD ["/u01/oracle/createAndStartEmptyDomain.sh"]
 ---> Running in 3a8437f5ed11
Removing intermediate container 3a8437f5ed11
 ---> 9dd72f2c0bc0
Successfully built 9dd72f2c0bc0
Successfully tagged oracle/weblogic:12.2.1.4-generic  WebLogic Docker Image for 'generic' version 12.2.1.4 is ready to be extended:    --> oracle/weblogic:12.2.1.4-generic  Build completed in 121 seconds.

 

Build domain 


Build domain
[centos@dave 12213-domain]$ more ./build.sh
#! /bin/bash
#
#Copyright (c) 2019 Oracle and/or its affiliates. All rights reserved.
#
#Licensed under the Universal Permissive License v 1.0 as shown at http://oss.oracle.com/licenses/upl.
#
#Build WebLogic Domain image persisted to volumedocker build -f Dockerfile -t 12213-weblogic-domain-in-volume .
[centos@dave 12213-domain]$ vi Dockerfile
[centos@dave 12213-domain]$ ./build.sh
Sending build context to Docker daemon  37.89kB
Step 1/11 : FROM oracle/weblogic:12.2.1.4-generic
 ---> 4ce73a139125
Step 2/11 : LABEL "provider"="Oracle"                                                     "maintainer"="Monica Riccelli <monica.riccelli@oracle.com>"             "issues"="https://github.com/oracle/docker-images/issues"               "port.admin.listen"="7001"                                              "port.administration"="9002"                                            "port.managed.server"="8001"
 ---> Running in c835f39122df
Removing intermediate container c835f39122df
 ---> b9c89cbdf500
Step 3/11 : ENV DOMAIN_ROOT="/u01/oracle/user_projects/domains"     ADMIN_HOST="${ADMIN_HOST:-AdminContainer}"     MANAGED_SERVER_PORT="${MANAGED_SERVER_PORT:-8001}"     MANAGED_SERVER_NAME_BASE="${MANAGED_SERVER_NAME_BASE:-MS}"     MANAGED_SERVER_CONTAINER="${MANAGED_SERVER_CONTAINER:-false}"     CONFIGURED_MANAGED_SERVER_COUNT="${CONFIGURED_MANAGED_SERVER_COUNT:-2}"     MANAGED_NAME="${MANAGED_NAME:-MS1}"     CLUSTER_NAME="${CLUSTER_NAME:-cluster1}"     CLUSTER_TYPE="${CLUSTER_TYPE:-DYNAMIC}"     PROPERTIES_FILE_DIR="/u01/oracle/properties"     JAVA_OPTIONS="-Doracle.jdbc.fanEnabled=false -Dweblogic.StdoutDebugEnabled=false"      PATH="$PATH:${JAVA_HOME}/bin:/u01/oracle/oracle_common/common/bin:/u01/oracle/wlserver/common/bin:/u01/oracle/container-scripts"
 ---> Running in 84b5fc5ce774
Removing intermediate container 84b5fc5ce774
 ---> 522568b73d0f
Step 4/11 : COPY --chown=oracle:oracle container-scripts/* /u01/oracle/container-scripts/
 ---> 46366a86c0a3
Step 5/11 : COPY --chown=oracle:oracle container-scripts/get_healthcheck_url.sh /u01/oracle/get_healthcheck_url.sh
 ---> de84286612b9
Step 6/11 : USER root
 ---> Running in 378af82336af
Removing intermediate container 378af82336af
 ---> 1e46b9768728
Step 7/11 : RUN mkdir -p $DOMAIN_ROOT &&     chown -R oracle:oracle $DOMAIN_ROOT/.. &&     chmod -R a+xwr $DOMAIN_ROOT/.. &&     mkdir -p $ORACLE_HOME/properties &&     chmod -R a+r $ORACLE_HOME/properties &&     chmod +x /u01/oracle/container-scripts/*
 ---> Running in 9eaa3b52ebc4
Removing intermediate container 9eaa3b52ebc4
 ---> 1547b3da749e
Step 8/11 : VOLUME $DOMAIN_ROOT
 ---> Running in 23f2f75bf138
Removing intermediate container 23f2f75bf138
 ---> 0ba76fec1693
Step 9/11 : USER oracle
 ---> Running in dcb7192cd277
Removing intermediate container dcb7192cd277
 ---> 7b9bdaa230d9
Step 10/11 : WORKDIR $ORACLE_HOME
 ---> Running in 1fdfd3c2a584
Removing intermediate container 1fdfd3c2a584
 ---> 5dd674f9a68b
Step 11/11 : CMD ["/u01/oracle/container-scripts/createWLSDomain.sh"]
 ---> Running in f03451d26803
Removing intermediate container f03451d26803
 ---> 29cc97f25353
Successfully built 29cc97f25353
Successfully tagged 12213-weblogic-domain-in-volume:latest


Start Admin server

 
 
./run_admin_server.sh
Context for docker build is /git/docker-images/OracleWebLogic/samples/12213-domain
Export environment variables from the /git/docker-images/OracleWebLogic/samples/12213-domain/properties/domain.properties properties file
 env_arg: DOMAIN_NAME=myDomain
 env_arg: ADMIN_NAME=myadmin
 env_arg: ADMIN_LISTEN_PORT=7001
 env_arg: ADMIN_HOST=AdminContainer
 env_arg: ADMINISTRATION_PORT_ENABLED=false
 env_arg: ADMINISTRATION_PORT=9002
 env_arg: MANAGED_SERVER_PORT=8001
 env_arg: MANAGED_SERVER_NAME_BASE=MS
 env_arg: CONFIGURED_MANAGED_SERVER_COUNT=2
 env_arg: CLUSTER_NAME=cluster1
 env_arg: CLUSTER_TYPE=DYNAMIC
 env_arg: PRODUCTION_MODE=dev
 env_arg: DOMAIN_HOST_VOLUME=/app/domains
The domain configuration will get persisted in the host volume: /app/domains
administrationport=9002
docker run -d -p 9001:7001 -p 9002:9002 --name AdminContainer --hostname AdminContainer -v /git/docker-images/OracleWebLogic/samples/12213-domain/properties:/u01/oracle/properties -v /app/domains:/u01/oracle/user_projects/domains  -e DOMAIN_NAME=myDomain -e ADMIN_NAME=myadmin -e ADMIN_LISTEN_PORT=7001 -e ADMIN_HOST=AdminContainer -e ADMINISTRATION_PORT_ENABLED=false -e ADMINISTRATION_PORT=9002 -e MANAGED_SERVER_PORT=8001 -e MANAGED_SERVER_NAME_BASE=MS -e CONFIGURED_MANAGED_SERVER_COUNT=2 -e CLUSTER_NAME=cluster1 -e CLUSTER_TYPE=DYNAMIC -e PRODUCTION_MODE=dev 12213-weblogic-domain-in-volume
bb8e16947737ca93b174397ef47fb2427b4ea349ed0dad93c609172006ad842a
[centos@dave 12213-domain]$ docker ps
CONTAINER ID        IMAGE                             COMMAND                  CREATED             STATUS                            PORTS                                            NAMES
bb8e16947737        12213-weblogic-domain-in-volume   "/u01/oracle/contain…"   5 seconds ago       Up 4 seconds (health: starting)   0.0.0.0:9002->9002/tcp, 0.0.0.0:9001->7001/tcp   AdminContainer


On Fedora with SE Linux add :z to mounted host volume to allow access for container 

https://www.reddit.com/r/Fedora/comments/g38e3g/docker_volume_mount_permission_denied/

https://docs.docker.com/storage/bind-mounts/#configure-the-selinux-label

 Without this there is error because mounted host volume with password files is not accessible for container.

A properties file with the username and password needs to be supplied.

[dave@dave 12.2.1.4]$ docker run -d -p 7001:7001 -p 9002:9002  -v /app/domains/properties:/u01/oracle/properties:z -e ADMINISTRATION_PORT_ENABLED=true -e DOMAIN_NAME=docker_domain oracle/weblogic:12.2.1.4-generic
145f8e92131287cc11c58c310724bd416173c64f4b605da3863e2cd80aee354a
[dave@dave 12.2.1.4]$ docker ps
CONTAINER ID        IMAGE                              COMMAND                  CREATED             STATUS                            PORTS                                            NAMES
145f8e921312        oracle/weblogic:12.2.1.4-generic   "/u01/oracle/createA…"   3 seconds ago       Up 2 seconds (health: starting)   0.0.0.0:7001->7001/tcp, 0.0.0.0:9002->9002/tcp   vigilant_gould